<!doctype html><html><head><script type="text/javascript">   function Vector(){var t=arguments.length;3===t?(this.x=arguments[0],this.y=arguments[1],this.z=arguments[2]):1===t?(this.x=arguments[0].x,this.y=arguments[0].y,this.z=arguments[0].z):(this.x=0,this.y=0,this.z=0)}function Particle(t){this.position=new Vector,this.velocity=new Vector,this.force=new Vector,this.mass=t,this.fixed=!1,this.age=0,this.dead=!1}function Spring(t,e,n,i,r){this.constant=n,this.damping=i,this.length=r,this.a=t,this.b=e,this.on=!0}function Attraction(t,e,n,i){this.a=t,this.b=e,this.constant=n,this.on=!0,this.distanceMin=i,this.distanceMinSquared=i*i}function RungeKuttaIntegrator(t){this.s=t,this.originalPositions=[],this.originalVelocities=[],this.k1Forces=[],this.k1Velocities=[],this.k2Forces=[],this.k2Velocities=[],this.k3Forces=[],this.k3Velocities=[],this.k4Forces=[],this.k4Velocities=[]}function ParticleSystem(){this.particles=[],this.springs=[],this.attractions=[],this.forces=[],this.integrator=new RungeKuttaIntegrator(this),this.hasDeadParticles=!1;var t=arguments.length;2===t?(this.gravity=new Vector(0,arguments[0],0),this.drag=arguments[1]):4===t?(this.gravity=new Vector(arguments[0],arguments[1],arguments[2]),this.drag=arguments[3]):(this.gravity=new Vector(0,ParticleSystem.DEFAULT_GRAVITY,0),this.drag=ParticleSystem.DEFAULT_DRAG)}function onFrame(t){Jiggler.update(),frameCount++,TWEEN.update(),updatePaths(),firstRun=!1}function onDraw(t){var e=pathBody.segments[numPoints-2],n=e.angle+Math.PI/2,i=(10*(Math.random()-Math.random()),Math.max(0,eyeJiggler.pos));eye1Pos.x=e.point.x,eye1Pos.y=e.point.y,eye1Pos.x+=Math.cos(n)*thickness/2.4,eye1Pos.y+=Math.sin(n)*thickness/2.4,eye2Pos.x=e.point.x,eye2Pos.y=e.point.y,eye2Pos.x-=Math.cos(n)*thickness/12,eye2Pos.y-=Math.sin(n)*thickness/12,t.fillStyle="#fff",t.save(),t.translate(eye1Pos.x,eye1Pos.y),t.rotate(n),t.scale(1,peaking?1:eyeHeight.s),circle(t,i),t.restore(),t.save(),t.translate(eye2Pos.x,eye2Pos.y),t.rotate(n),t.scale(peaking?1.2:1,peaking?1.2:eyeHeight.s),circle(t,i),t.restore(),t.shadowBlur=0,t.shadowOffsetY=0}function onMouseDown(t){mouseDown=!0}function onMouseUp(t){mouseDown=!1,params.needsDrag&&(targetMousePos.x=view.size.width/2,targetMousePos.y=view.size.height-segmentLength)}function onMouseMove(t){if(!params.needsDrag||mouseDown){var e=Math.atan2(t.point.y-view.size.height,t.point.x-view.size.width/2);targetMousePos.x=view.size.width/2+Math.cos(e)*segmentLength*3,targetMousePos.y=view.size.height+Math.sin(e)*segmentLength}}function onResize(){document.getElementById("canvas").height++,document.getElementById("canvas").width++,segmentLength=getSegmentLength(),particles[0].position.x=view.size.width/2,particles[0].position.y=view.size.height+segmentLength,targetMousePos.x=view.size.width/2,targetMousePos.y=view.size.height-segmentLength;for(var t=0;t<springs.length;t++)springs[t].length=segmentLength}function getSegmentLength(){return view.size.height/numPoints*.7}function buildMouth(){for(var t=0;mouthPoints>t;t++)pathMouth.add(new Point),mouthPoints-2>t&&pathTongue.add(new Point)}function buildBody(){for(i=0;i<numPoints;i++){var t=view.size.width/2,e=view.size.height-(i-1)*segmentLength,n=physics.makeParticle(2.5,t,e,0),r=physics.makeParticle(1,t,e-segmentLength,0),s=physics.makeParticle(1,t,e+segmentLength,0);if(i>0){var o=supports[i-1],a=particles[i-1];physics.makeSpring(n,o,.6,.48,0),physics.makeSpring(a,s,.3,.7,0),springs.push(physics.makeSpring(n,a,.2,.1,segmentLength))}i<2&&n.makeFixed(),r.makeFixed(),s.makeFixed();var u=new Point;pathBody.add(u),particles.push(n),supports.push(r),supports2.push(s)}}function setPositions(){var t=mouseDown?params.mouseTargetEasing:params.mouseTargetEasingUp;mousePos.x+=(targetMousePos.x-mousePos.x)*t,mousePos.y+=(targetMousePos.y-mousePos.y)*t,particles[1].position.x=mousePos.x,particles[1].position.y=mousePos.y;for(var e=0,n=1;numPoints>n;n++){var i=supports[n],r=particles[n];r.position.x=clamp(r.position.x,padding,view.size.width-padding);var s=particles[n-1],o=Math.atan2(r.position.y-s.position.y,r.position.x-s.position.x),a=r.force.length();a>maxForce&&(r.force.scale(a/maxForce),a=maxForce),n>1&&(e+=a),i.position.x=r.position.x+Math.cos(o+n*bend)*segmentLength,i.position.y=r.position.y+Math.sin(o+n*bend)*segmentLength,pathBody.segments[n].angle=o;var u=supports2[n];u.position.x=r.position.x+Math.cos(Math.PI+o)*segmentLength,u.position.y=r.position.y+Math.sin(Math.PI+o)*segmentLength}stress+=.03*(e-stress)}function updateAppearance(){stress>80?(hue+=stress>300?Math.pow(stress/5,2):stress,pathBody.strokeColor="hsl("+Math.round(hue)%360+", 100%, 50%)",pathMouth.strokeColor="hsl("+Math.round(hue)%360+", 100%, 90%)",pathTongue.strokeColor="hsl("+Math.round(hue)%360+", 100%, 50%)",pathMouth.strokeWidth=thickness/1.5+20*(Math.random()-Math.random()),pathTongue.strokeWidth=.65*pathMouth.strokeWidth,peaking=!0,clearTimeout(wrong),document.getElementById("shake").style.display="none"):(pathBody.strokeColor=params.fillColor,peaking=!1),peaking?(document.body.className=frameCount%3!=0?"bg-a":"bg-b",prevPeaking||(physics.drag=.2,pathMouth.opacity=1,pathTongue.opacity=1,eyeJiggler.rest=17),firstPlay&&audio&&(audio.setVolume(50),audio2.setVolume(70),firstPlay=!1)):!peaking&&prevPeaking&&(document.body.className="",physics.drag=restDrag,pathMouth.opacity=0,pathTongue.opacity=0,eyeJiggler.rest=6,audio&&(audio.setVolume(0),audio2.setVolume(0),firstPlay=!0)),prevPeaking=peaking}function updatePaths(){for(var t,e,n=0;numPoints>n;n++){var i=particles[n],r=(particles[n-1],pathBody.segments[n].angle+Math.PI/2);pathBody.segments[n].point.x=i.position.x,pathBody.segments[n].point.y=i.position.y,t=n-mouthPadding+1,e=pathMouth.segments.length,t>=0&&e>t&&(pathMouth.segments[t].point.x=i.position.x,pathMouth.segments[t].point.y=i.position.y,pathMouth.segments[t].point.x+=Math.cos(r)*thickness/6,pathMouth.segments[t].point.y+=Math.sin(r)*thickness/10,pathTongue.segments[t]&&(pathTongue.segments[t].point.x=pathMouth.segments[t].point.x,pathTongue.segments[t].point.y=pathMouth.segments[t].point.y,pathTongue.segments[t].point.x-=Math.cos(r)*(pathMouth.strokeWidth/15),pathTongue.segments[t].point.y-=Math.sin(r)*(pathMouth.strokeWidth/5)))}if(smooth)for(var n=0,e=paths.length;e>n;n++)paths[n].smooth()}function buildGUI(){var t=new dat.GUI;t.add(params,"mouseXWidth",0,1),t.add(params,"mouseYMin",0,1),t.add(params,"mouseTargetEasing",0,1),t.add(params,"needsDrag"),t.addColor(params,"fillColor"),t.addColor(params,"strokeColor")}function unSmooth(){for(var t=0,e=paths.length;e>t;t++)for(var n=paths[t],i=0,r=n.segments.length;r>i;i++){var s=n.segments[i];s.handleIn=s.handleOut=null}}function clamp(t,e,n){return e>t?e:t>n?n:t}function circle(t,e,n,i){t.beginPath(),t.arc(0,0,e,n||0,i||2*Math.PI,!0),t.fill()}var paper=new function(){var Base=new function(){function t(t,e,n){if(_)try{return delete t[e],_(t,e,n)}catch(i){}return(n.get||n.set)&&t.__defineGetter__?(n.get&&t.__defineGetter__(e,n.get),n.set&&t.__defineSetter__(e,n.set)):t[e]=n.value,t}function e(t,e){if(m)try{return m(t,e)}catch(n){}var i=t.__lookupGetter__&&t.__lookupGetter__(e);return i?{get:i,set:t.__lookupSetter__(e),enumerable:!0,configurable:!0}:l.call(t,e)?{value:t[e],enumerable:!0,configurable:!0,writable:!0}:null}function n(n,i,r,s,o,a){function h(a,u,h,g){var u=u||(u=e(i,a))&&(u.get?u:u.value),p="function"==typeof u,_=u,m=o||p?u&&u.get?a in n:n[a]:null;if(!g||!p||o&&g[a]||(g[a]=function(t){return t&&n[a].apply(t,f.call(arguments,1))}),(h||void 0!==u&&l.call(i,a))&&(!o||!m)){if(p){if(m&&/\bthis\.base\b/.test(u)){var v=s&&s[a]==m;_=function(){var n=e(this,"base");t(this,"base",{value:v?s[a]:m,configurable:!0});try{return u.apply(this,arguments)}finally{n?t(this,"base",n):delete this.base}},_.toString=function(){return u.toString()},_.valueOf=function(){return u.valueOf()}}c&&0==u.length&&(d=a.match(/^(get|is)(([A-Z])(.*))$/))&&c.push([d[3].toLowerCase()+d[4],d[2]])}(!_||p||!_.get&&!_.set)&&(_={value:_,writable:!0}),(e(n,a)||{configurable:!0}).configurable&&(_.configurable=!0,_.enumerable=r),t(n,a,_)}}var c,d;if(i){c=[];for(var g in i)l.call(i,g)&&!u.test(g)&&h(g,null,!0,a);h("toString"),h("valueOf");for(var p=0,_=c&&c.length;_>p;p++)try{var d=c[p],m=d[1];h(d[0],{get:n["get"+m]||n["is"+m],set:n["set"+m]},!0)}catch(v){}}return n}function i(e){var n=function(i){return a&&t(this,"__proto__",{value:e}),this.initialize&&i!==n.dont?this.initialize.apply(this,arguments):void 0};return n.prototype=e,n.toString=function(){return(this.prototype.initialize||function(){}).toString()},n}function r(t){return t?"function"!=typeof t?function(e){return e==t}:t:function(t){return t}}function s(t,e,n,i){try{t&&(i||void 0===i&&d(t)?g:p).call(t,r(e),n=n||t)}catch(s){if(s!==Base.stop)throw s}return n}function o(t){return s(t,function(t,e){this[e]=t},new t.constructor)}var a=!this.__proto__,u=/^(statics|generics|preserve|enumerable|prototype|__proto__|toString|valueOf)$/,h=Object.prototype,l=a?function(t){return"__proto__"!==t&&this.hasOwnProperty(t)}:h.hasOwnProperty,c=h.toString,h=Array.prototype,d=Array.isArray=Array.isArray||function(t){return"[object Array]"===c.call(t)},f=h.slice,g=h.forEach=h.forEach||function(t,e){for(var n=0,i=this.length;i>n;n++)t.call(e,this[n],n,this)},p=function(t,e){for(var n in this)this.hasOwnProperty(n)&&t.call(e,this[n],n,this)},_=Object.defineProperty,m=Object.getOwnPropertyDescriptor;return n(function(){},{inject:function(t){if(t){var e=this.prototype,i=e.__proto__&&e.__proto__.constructor,r=1==t.statics?t:t.statics;r!=t&&n(e,t,t.enumerable,i&&i.prototype,t.preserve,t.generics&&this),n(this,r,!0,i,t.preserve)}for(var s=1,o=arguments.length;o>s;s++)this.inject(arguments[s]);return this},extend:function(e){var r=new this(this.dont),s=i(r);return t(r,"constructor",{value:s,writable:!0,configurable:!0}),s.dont={},n(s,this,!0),arguments.length?this.inject.apply(s,arguments):s}},!0).inject({has:l,each:s,inject:function(){for(var t=0,e=arguments.length;e>t;t++)n(this,arguments[t]);return this},extend:function(){var t=new(i(this));return t.inject.apply(t,arguments)},each:function(t,e){return s(this,t,e)},clone:function(){return o(this)},statics:{each:s,clone:o,define:t,describe:e,iterator:r,has:function(t,e){return l.call(t,e)},type:function(t){return(t||0===t)&&(t._type||typeof t)||null},check:function(t){return!(!t&&0!==t)},pick:function(){for(var t=0,e=arguments.length;e>t;t++)if(void 0!==arguments[t])return arguments[t];return null},stop:{}}})};this.Base=Base.inject({generics:!0,clone:function(){return new this.constructor(this)},toString:function(){return"{ "+Base.each(this,function(t,e){if("_"!=e.charAt(0)){var n=typeof t;this.push(e+": "+("number"===n?Base.formatNumber(t):"string"===n?"'"+t+"'":t))}},[]).join(", ")+" }"},statics:{read:function(t,e,n){var e=e||0,n=n||t.length-e,i=t[e];return i instanceof this||this.prototype._readNull&&null==i&&1>=n?i:(i=new this(this.dont),i.initialize.apply(i,e>0||n<t.length?Array.prototype.slice.call(t,e,e+n):t)||i)},readAll:function(t,e){for(var n,i=[],r=e||0,s=t.length;s>r;r++)i.push(Array.isArray(n=t[r])?this.read(n,0):this.read(t,r,1));return i},splice:function(t,e,n,i){var r=e&&e.length,s=void 0===n;n=s?t.length:n;for(var o=0;r>o;o++)e[o]._index=n+o;if(s)return t.push.apply(t,e),[];var a=[n,i];e&&a.push.apply(a,e);for(var u=t.splice.apply(t,a),o=0,h=u.length;h>o;o++)delete u[o]._index;for(var o=n+r,h=t.length;h>o;o++)t[o]._index=o;return u},merge:function(){return Base.each(arguments,function(t){Base.each(t,function(t,e){this[e]=t},this)},new Base,!0)},capitalize:function(t){return t.replace(/\b[a-z]/g,function(t){return t.toUpperCase()})},camelize:function(t){return t.replace(/-(\w)/g,function(t,e){return e.toUpperCase()})},hyphenate:function(t){return t.replace(/[a-z][A-Z0-9]|[0-9][a-zA-Z]|[A-Z]{2}[a-z]/g,function(t){return t.charAt(0)+"-"+t.substring(1)}).toLowerCase()},formatNumber:function(t){return(Math.round(1e5*t)/1e5).toString()}}});var PaperScope=this.PaperScope=Base.extend({initialize:function(t){paper=this,this.view=null,this.views=[],this.project=null,this.projects=[],this.tool=null,this.tools=[],this._id=t&&(t.getAttribute("id")||t.src)||"paperscope-"+PaperScope._id++,t&&t.setAttribute("id",this._id),PaperScope._scopes[this._id]=this},version:.22,evaluate:function(t){var e=PaperScript.evaluate(t,this);return View.updateFocus(),e},install:function(t){var e=this;Base.each(["project","view","tool"],function(n){Base.define(t,n,{configurable:!0,writable:!0,get:function(){return e[n]}})});for(var n in this)/^(version|_id|load)/.test(n)||n in t||(t[n]=this[n])},setup:function(t){paper=this,this.project=new Project,t&&(this.view=new View(t))},clear:function(){for(var t=this.projects.length-1;t>=0;t--)this.projects[t].remove();for(var t=this.views.length-1;t>=0;t--)this.views[t].remove();for(var t=this.tools.length-1;t>=0;t--)this.tools[t].remove()},remove:function(){this.clear(),delete PaperScope._scopes[this._id]},_needsRedraw:function(){if(!this._redrawNotified){for(var t=this.views.length-1;t>=0;t--)this.views[t]._redrawNeeded=!0;this._redrawNotified=!0}},statics:{_scopes:{},_id:0,get:function(t){return"object"==typeof t&&(t=t.getAttribute("id")),this._scopes[t]||null},each:function(t){Base.each(this._scopes,t)}}}),PaperScopeItem=Base.extend({initialize:function(t){this._scope=paper,this._index=this._scope[this._list].push(this)-1,(t||!this._scope[this._reference])&&this.activate()},activate:function(){return this._scope?(this._scope[this._reference]=this,!0):!1},remove:function(){return null==this._index?!1:(Base.splice(this._scope[this._list],null,this._index,1),this._scope[this._reference]==this&&(this._scope[this._reference]=null),this._scope=null,!0)}}),Point=this.Point=Base.extend({initialize:function(t,e){void 0!==e?(this.x=t,this.y=e):void 0!==t?null==t?this.x=this.y=0:void 0!==t.x?(this.x=t.x,this.y=t.y):void 0!==t.width?(this.x=t.width,this.y=t.height):Array.isArray(t)?(this.x=t[0],this.y=t.length>1?t[1]:t[0]):void 0!==t.angle?(this.x=t.length,this.y=0,this.setAngle(t.angle)):"number"==typeof t?this.x=this.y=t:this.x=this.y=0:this.x=this.y=0},set:function(t,e){return this.x=t,this.y=e,this},clone:function(){return Point.create(this.x,this.y)},toString:function(){var t=Base.formatNumber;return"{ x: "+t(this.x)+", y: "+t(this.y)+" }"},add:function(t){return t=Point.read(arguments),Point.create(this.x+t.x,this.y+t.y)},subtract:function(t){return t=Point.read(arguments),Point.create(this.x-t.x,this.y-t.y)},multiply:function(t){return t=Point.read(arguments),Point.create(this.x*t.x,this.y*t.y)},divide:function(t){return t=Point.read(arguments),Point.create(this.x/t.x,this.y/t.y)},modulo:function(t){return t=Point.read(arguments),Point.create(this.x%t.x,this.y%t.y)},negate:function(){return Point.create(-this.x,-this.y)},transform:function(t){return t?t._transformPoint(this):this},getDistance:function(t,e){t=Point.read(arguments);var n=t.x-this.x,i=t.y-this.y,r=n*n+i*i;return e?r:Math.sqrt(r)},getLength:function(){var t=this.x*this.x+this.y*this.y;return arguments[0]?t:Math.sqrt(t)},setLength:function(t){if(this.isZero()){var e=this._angle||0;this.set(Math.cos(e)*t,Math.sin(e)*t)}else{var n=t/this.getLength();0==n&&this.getAngle(),this.set(this.x*n,this.y*n)}return this},normalize:function(t){void 0===t&&(t=1);var e=this.getLength(),n=0!=e?t/e:0,i=Point.create(this.x*n,this.y*n);return i._angle=this._angle,i},getAngle:function(){return 180*this.getAngleInRadians(arguments[0])/Math.PI},setAngle:function(t){if(t=this._angle=t*Math.PI/180,!this.isZero()){var e=this.getLength();this.set(Math.cos(t)*e,Math.sin(t)*e)}return this},getAngleInRadians:function(){if(void 0===arguments[0])return null==this._angle&&(this._angle=Math.atan2(this.y,this.x)),this._angle;var t=Point.read(arguments),e=this.getLength()*t.getLength();return 0==e?NaN:Math.acos(this.dot(t)/e)},getAngleInDegrees:function(){return this.getAngle(arguments[0])},getQuadrant:function(){return this.x>=0?this.y>=0?1:4:this.y>=0?2:3},getDirectedAngle:function(t){return t=Point.read(arguments),180*Math.atan2(this.cross(t),this.dot(t))/Math.PI},rotate:function(t,e){t=t*Math.PI/180;var n=e?this.subtract(e):this,i=Math.sin(t),r=Math.cos(t);return n=Point.create(n.x*r-n.y*i,n.y*r+n.x*i),e?n.add(e):n},equals:function(t){return t=Point.read(arguments),this.x==t.x&&this.y==t.y},isInside:function(t){return t.contains(this)},isClose:function(t,e){return this.getDistance(t)<e},isColinear:function(t){return this.cross(t)<Numerical.TOLERANCE},isOrthogonal:function(t){return this.dot(t)<Numerical.TOLERANCE},isZero:function(){return 0==this.x&&0==this.y},isNaN:function(){return isNaN(this.x)||isNaN(this.y)},dot:function(t){return t=Point.read(arguments),this.x*t.x+this.y*t.y},cross:function(t){return t=Point.read(arguments),this.x*t.y-this.y*t.x},project:function(t){if(t=Point.read(arguments),t.isZero())return Point.create(0,0);var e=this.dot(t)/t.dot(t);return Point.create(t.x*e,t.y*e)},statics:{create:function(t,e){var n=new Point(Point.dont);return n.x=t,n.y=e,n},min:function(t,e){return t=Point.read(arguments,0,1),e=Point.read(arguments,1,1),Point.create(Math.min(t.x,e.x),Math.min(t.y,e.y))},max:function(t,e){return t=Point.read(arguments,0,1),e=Point.read(arguments,1,1),Point.create(Math.max(t.x,e.x),Math.max(t.y,e.y))},random:function(){return Point.create(Math.random(),Math.random())}}},new function(){return Base.each(["round","ceil","floor","abs"],function(t){var e=Math[t];this[t]=function(){return Point.create(e(this.x),e(this.y))}},{})}),LinkedPoint=Point.extend({set:function(t,e,n){return this._x=t,this._y=e,n||this._owner[this._setter](this),this},getX:function(){return this._x},setX:function(t){this._x=t,this._owner[this._setter](this)},getY:function(){return this._y},setY:function(t){this._y=t,this._owner[this._setter](this)},statics:{create:function(t,e,n,i,r){if(r)return Point.create(n,i);var s=new LinkedPoint(LinkedPoint.dont);return s._x=n,s._y=i,s._owner=t,s._setter=e,s}}}),Size=this.Size=Base.extend({initialize:function(t,e){void 0!==e?(this.width=t,this.height=e):void 0!==t?null==t?this.width=this.height=0:void 0!==t.width?(this.width=t.width,this.height=t.height):void 0!==t.x?(this.width=t.x,this.height=t.y):Array.isArray(t)?(this.width=t[0],this.height=t.length>1?t[1]:t[0]):"number"==typeof t?this.width=this.height=t:this.width=this.height=0:this.width=this.height=0},toString:function(){var t=Base.formatNumber;return"{ width: "+t(this.width)+", height: "+t(this.height)+" }"},set:function(t,e){return this.width=t,this.height=e,this},clone:function(){return Size.create(this.width,this.height)},add:function(t){return t=Size.read(arguments),Size.create(this.width+t.width,this.height+t.height)},subtract:function(t){return t=Size.read(arguments),Size.create(this.width-t.width,this.height-t.height)},multiply:function(t){return t=Size.read(arguments),Size.create(this.width*t.width,this.height*t.height)},divide:function(t){return t=Size.read(arguments),Size.create(this.width/t.width,this.height/t.height)},modulo:function(t){return t=Size.read(arguments),Size.create(this.width%t.width,this.height%t.height)},negate:function(){return Size.create(-this.width,-this.height)},equals:function(t){return t=Size.read(arguments),this.width==t.width&&this.height==t.height},isZero:function(){return 0==this.width&&0==this.height},isNaN:function(){return isNaN(this.width)||isNaN(this.height)},statics:{create:function(t,e){return new Size(Size.dont).set(t,e)},min:function(t,e){return Size.create(Math.min(t.width,e.width),Math.min(t.height,e.height))},max:function(t,e){return Size.create(Math.max(t.width,e.width),Math.max(t.height,e.height))},random:function(){return Size.create(Math.random(),Math.random())}}},new function(){return Base.each(["round","ceil","floor","abs"],function(t){var e=Math[t];this[t]=function(){return Size.create(e(this.width),e(this.height))}},{})}),LinkedSize=Size.extend({set:function(t,e,n){return this._width=t,this._height=e,n||this._owner[this._setter](this),this},getWidth:function(){return this._width},setWidth:function(t){this._width=t,this._owner[this._setter](this)},getHeight:function(){return this._height},setHeight:function(t){this._height=t,this._owner[this._setter](this)},statics:{create:function(t,e,n,i,r){if(r)return Size.create(n,i);var s=new LinkedSize(LinkedSize.dont);return s._width=n,s._height=i,s._owner=t,s._setter=e,s}}}),Rectangle=this.Rectangle=Base.extend({initialize:function(t,e,n,i){if(4==arguments.length)this.x=t,this.y=e,this.width=n,this.height=i;else if(2==arguments.length)if(e&&void 0!==e.x){var r=Point.read(arguments,0,1),s=Point.read(arguments,1,1);this.x=r.x,this.y=r.y,this.width=s.x-r.x,this.height=s.y-r.y,this.width<0&&(this.x=s.x,this.width=-this.width),this.height<0&&(this.y=s.y,this.height=-this.height)}else{var o=Point.read(arguments,0,1),a=Size.read(arguments,1,1);this.x=o.x,this.y=o.y,this.width=a.width,this.height=a.height}else t?(this.x=t.x||0,this.y=t.y||0,this.width=t.width||0,this.height=t.height||0):this.x=this.y=this.width=this.height=0},set:function(t,e,n,i){return this.x=t,this.y=e,this.width=n,this.height=i,this},getPoint:function(){return LinkedPoint.create(this,"setPoint",this.x,this.y,arguments[0])},setPoint:function(t){return t=Point.read(arguments),this.x=t.x,this.y=t.y,this},getSize:function(){return LinkedSize.create(this,"setSize",this.width,this.height,arguments[0])},setSize:function(t){return t=Size.read(arguments),this.width=t.width,this.height=t.height,this},getLeft:function(){return this.x},setLeft:function(t){return this.width-=t-this.x,this.x=t,this},getTop:function(){return this.y},setTop:function(t){return this.height-=t-this.y,this.y=t,this},getRight:function(){return this.x+this.width},setRight:function(t){return this.width=t-this.x,this},getBottom:function(){return this.y+this.height},setBottom:function(t){return this.height=t-this.y,this},getCenterX:function(){return this.x+.5*this.width},setCenterX:function(t){return this.x=t-.5*this.width,this},getCenterY:function(){return this.y+.5*this.height},setCenterY:function(t){return this.y=t-.5*this.height,this},getCenter:function(){return LinkedPoint.create(this,"setCenter",this.getCenterX(),this.getCenterY(),arguments[0])},setCenter:function(t){return t=Point.read(arguments),this.setCenterX(t.x).setCenterY(t.y)},equals:function(t){return t=Rectangle.read(arguments),this.x==t.x&&this.y==t.y&&this.width==t.width&&this.height==t.height},isEmpty:function(){return 0==this.width||0==this.height},toString:function(){var t=Base.formatNumber;return"{ x: "+t(this.x)+", y: "+t(this.y)+", width: "+t(this.width)+", height: "+t(this.height)+" }"},contains:function(t){return t&&void 0!==t.width||4==(Array.isArray(t)?t:arguments).length?this._containsRectangle(Rectangle.read(arguments)):this._containsPoint(Point.read(arguments))},_containsPoint:function(t){var e=t.x,n=t.y;return e>=this.x&&n>=this.y&&e<=this.x+this.width&&n<=this.y+this.height},_containsRectangle:function(t){var e=t.x,n=t.y;return e>=this.x&&n>=this.y&&e+t.width<=this.x+this.width&&n+t.height<=this.y+this.height},intersects:function(t){return t=Rectangle.read(arguments),t.x+t.width>this.x&&t.y+t.height>this.y&&t.x<this.x+this.width&&t.y<this.y+this.height},intersect:function(t){t=Rectangle.read(arguments);var e=Math.max(this.x,t.x),n=Math.max(this.y,t.y),i=Math.min(this.x+this.width,t.x+t.width),r=Math.min(this.y+this.height,t.y+t.height);return Rectangle.create(e,n,i-e,r-n)},unite:function(t){t=Rectangle.read(arguments);var e=Math.min(this.x,t.x),n=Math.min(this.y,t.y),i=Math.max(this.x+this.width,t.x+t.width),r=Math.max(this.y+this.height,t.y+t.height);return Rectangle.create(e,n,i-e,r-n)},include:function(t){t=Point.read(arguments);var e=Math.min(this.x,t.x),n=Math.min(this.y,t.y),i=Math.max(this.x+this.width,t.x),r=Math.max(this.y+this.height,t.y);return Rectangle.create(e,n,i-e,r-n)},expand:function(t,e){return void 0===e&&(e=t),Rectangle.create(this.x-t/2,this.y-e/2,this.width+t,this.height+e)},scale:function(t,e){return this.expand(this.width*t-this.width,this.height*(void 0===e?t:e)-this.height)},statics:{create:function(t,e,n,i){return new Rectangle(Rectangle.dont).set(t,e,n,i)}}},new function(){return Base.each([["Top","Left"],["Top","Right"],["Bottom","Left"],["Bottom","Right"],["Left","Center"],["Top","Center"],["Right","Center"],["Bottom","Center"]],function(t,e){var n=t.join(""),i=/^[RL]/.test(n);e>=4&&(t[1]+=i?"Y":"X");var r=t[i?0:1],s=t[i?1:0],o="get"+r,a="get"+s,u="set"+r,h="set"+s,l="get"+n,c="set"+n;this[l]=function(){return LinkedPoint.create(this,c,this[o](),this[a](),arguments[0])},this[c]=function(t){return t=Point.read(arguments),this[u](t.x)[h](t.y)}},{})}),LinkedRectangle=Rectangle.extend({set:function(t,e,n,i,r){return this._x=t,this._y=e,this._width=n,this._height=i,r||this._owner[this._setter](this),this},statics:{create:function(t,e,n,i,r,s){var o=new LinkedRectangle(LinkedRectangle.dont).set(n,i,r,s,!0);return o._owner=t,o._setter=e,o}}},new function(){var t=Rectangle.prototype;return Base.each(["x","y","width","height"],function(t){var e=Base.capitalize(t),n="_"+t;this["get"+e]=function(){return this[n]},this["set"+e]=function(t){this[n]=t,this._dontNotify||this._owner[this._setter](this)}},Base.each(["Point","Size","Center","Left","Top","Right","Bottom","CenterX","CenterY","TopLeft","TopRight","BottomLeft","BottomRight","LeftCenter","TopCenter","RightCenter","BottomCenter"],function(e){var n="set"+e;this[n]=function(e){return this._dontNotify=!0,t[n].apply(this,arguments),delete this._dontNotify,this._owner[this._setter](this),this}},{}))}),Matrix=this.Matrix=Base.extend({initialize:function(t){var e=arguments.length,n=!0;if(6==e?this.set.apply(this,arguments):1==e?t instanceof Matrix?this.set(t._a,t._c,t._b,t._d,t._tx,t._ty):Array.isArray(t)?this.set.apply(this,t):n=!1:0==e?(this._a=this._d=1,this._c=this._b=this._tx=this._ty=0):n=!1,!n)throw new Error("Unsupported matrix parameters")},clone:function(){return Matrix.create(this._a,this._c,this._b,this._d,this._tx,this._ty)},set:function(t,e,n,i,r,s){return this._a=t,this._c=e,this._b=n,this._d=i,this._tx=r,this._ty=s,this},scale:function(t,e,n){return arguments.length<2||"object"==typeof e?(n=Point.read(arguments,1),e=t):n=Point.read(arguments,2),n&&this.translate(n),this._a*=t,this._c*=t,this._b*=e,this._d*=e,n&&this.translate(n.negate()),this},translate:function(t){t=Point.read(arguments);var e=t.x,n=t.y;return this._tx+=e*this._a+n*this._b,this._ty+=e*this._c+n*this._d,this},rotate:function(t,e){return this.concatenate(Matrix.getRotateInstance.apply(Matrix,arguments))},shear:function(t,e,n){arguments.length<2||"object"==typeof e?(n=Point.read(arguments,1),e=t):n=Point.read(arguments,2),n&&this.translate(n);var i=this._a,r=this._c;return this._a+=e*this._b,this._c+=e*this._d,this._b+=t*i,this._d+=t*r,n&&this.translate(n.negate()),this},toString:function(){var t=Base.formatNumber;return"[["+[t(this._a),t(this._b),t(this._tx)].join(", ")+"], ["+[t(this._c),t(this._d),t(this._ty)].join(", ")+"]]"},getValues:function(){return[this._a,this._c,this._b,this._d,this._tx,this._ty]},concatenate:function(t){var e=this._a,n=this._b,i=this._c,r=this._d;return this._a=t._a*e+t._c*n,this._b=t._b*e+t._d*n,this._tx+=t._tx*e+t._ty*n,this._c=t._a*i+t._c*r,this._d=t._b*i+t._d*r,this._ty+=t._tx*i+t._ty*r,this},preConcatenate:function(t){var e=this._a,n=this._b,i=this._c,r=this._d,s=this._tx,o=this._ty;return this._a=t._a*e+t._b*i,this._c=t._c*e+t._d*i,this._b=t._a*n+t._b*r,this._d=t._c*n+t._d*r,this._tx=t._a*s+t._b*o+t._tx,this._ty=t._c*s+t._d*o+t._ty,this},transform:function(t,e,n,i,r){return arguments.length<5?this._transformPoint(Point.read(arguments)):this._transformCoordinates(t,e,n,i,r)},_transformPoint:function(t,e,n){var i=t.x,r=t.y;return e||(e=new Point(Point.dont)),e.set(i*this._a+r*this._b+this._tx,i*this._c+r*this._d+this._ty,n)},_transformCoordinates:function(t,e,n,i,r){for(var s=e,o=i,a=e+2*r;a>s;){var u=t[s++],h=t[s++];n[o++]=u*this._a+h*this._b+this._tx,n[o++]=u*this._c+h*this._d+this._ty}return n},_transformCorners:function(t){var e=t.x,n=t.y,i=e+t.width,r=n+t.height,s=[e,n,i,n,i,r,e,r];return this._transformCoordinates(s,0,s,0,4)},_transformBounds:function(t){for(var e=this._transformCorners(t),n=e.slice(0,2),i=e.slice(0),r=2;8>r;r++){var s=e[r],o=1&r;s<n[o]?n[o]=s:s>i[o]&&(i[o]=s)}return Rectangle.create(n[0],n[1],i[0]-n[0],i[1]-n[1])},inverseTransform:function(t){return this._inverseTransform(Point.read(arguments))},_getDeterminant:function(){var t=this._a*this._d-this._b*this._c;return isFinite(t)&&Math.abs(t)>Numerical.EPSILON&&isFinite(this._tx)&&isFinite(this._ty)?t:null},_inverseTransform:function(t,e,n){var i=this._getDeterminant();if(!i)return null;var r=t.x-this._tx,s=t.y-this._ty;return e||(e=new Point(Point.dont)),e.set((r*this._d-s*this._b)/i,(s*this._a-r*this._c)/i,n)},getTranslation:function(){return new Point(this._tx,this._ty)},getScaling:function(){var t=Math.sqrt(this._a*this._a+this._c*this._c),e=Math.sqrt(this._b*this._b+this._d*this._d);return new Point(this._a<0?-t:t,this._b<0?-e:e)},getRotation:function(){var t=-Math.atan2(this._b,this._d),e=Math.atan2(this._c,this._a);return Math.abs(t-e)<Numerical.TOLERANCE?180*t/Math.PI:void 0},isIdentity:function(){return 1==this._a&&0==this._c&&0==this._b&&1==this._d&&0==this._tx&&0==this._ty},isInvertible:function(){return!!this._getDeterminant()},isSingular:function(){return!this._getDeterminant()},createInverse:function(){var t=this._getDeterminant();return t&&Matrix.create(this._d/t,-this._c/t,-this._b/t,this._a/t,(this._b*this._ty-this._d*this._tx)/t,(this._c*this._tx-this._a*this._ty)/t)},createShiftless:function(){return Matrix.create(this._a,this._c,this._b,this._d,0,0)},setToScale:function(t,e){return this.set(t,0,0,e,0,0)},setToTranslation:function(t){return t=Point.read(arguments),this.set(1,0,0,1,t.x,t.y)},setToShear:function(t,e){return this.set(1,e,t,1,0,0)},setToRotation:function(t,e){e=Point.read(arguments,1),t=t*Math.PI/180;var n=e.x,i=e.y,r=Math.cos(t),s=Math.sin(t);return this.set(r,s,-s,r,n-n*r+i*s,i-n*s-i*r)},applyToContext:function(t,e){return t[e?"setTransform":"transform"](this._a,this._c,this._b,this._d,this._tx,this._ty),this},statics:{create:function(t,e,n,i,r,s){return new Matrix(Matrix.dont).set(t,e,n,i,r,s)},getScaleInstance:function(t,e){var n=new Matrix;return n.setToScale.apply(n,arguments)},getTranslateInstance:function(t){var e=new Matrix;return e.setToTranslation.apply(e,arguments)},getShearInstance:function(t,e,n){var i=new Matrix;return i.setToShear.apply(i,arguments)},getRotateInstance:function(t,e){var n=new Matrix;return n.setToRotation.apply(n,arguments)}}},new function(){return Base.each({scaleX:"_a",scaleY:"_d",translateX:"_tx",translateY:"_ty",shearX:"_b",shearY:"_c"},function(t,e){e=Base.capitalize(e),this["get"+e]=function(){return this[t]},this["set"+e]=function(e){this[t]=e}},{})}),Line=this.Line=Base.extend({initialize:function(t,e,n){t=Point.read(arguments,0,1),e=Point.read(arguments,1,1),3==arguments.length?(this.point=t,this.vector=e.subtract(t),this.infinite=n):(this.point=t,this.vector=e,this.infinite=!0)},intersect:function(t){var e=this.vector.cross(t.vector);if(Math.abs(e)<=Numerical.EPSILON)return null;var n=t.point.subtract(this.point),i=n.cross(t.vector)/e,r=n.cross(this.vector)/e;return(this.infinite||i>=0&&1>=i)&&(t.infinite||r>=0&&1>=r)?this.point.add(this.vector.multiply(i)):null},getSide:function(t){var e=this.vector,n=t.subtract(this.point),i=n.cross(e);return 0==i&&(i=n.dot(e),i>0&&(i=n.subtract(e).dot(e),0>i&&(i=0))),0>i?-1:i>0?1:0},getDistance:function(t){var e=this.vector.y/this.vector.x,n=this.point.y-e*this.point.x,i=Math.abs(t.y-e*t.x-n)/Math.sqrt(e*e+1);return this.infinite?i:Math.min(i,t.getDistance(this.point),t.getDistance(this.point.add(this.vector)))}}),Project=this.Project=PaperScopeItem.extend({_list:"projects",_reference:"project",initialize:function(){this.base(!0),this._currentStyle=new PathStyle,this._selectedItems={},this._selectedItemCount=0,this.layers=[],this.symbols=[],this.activeLayer=new Layer},   _needsRedraw:function(){this._scope&&this._scope._needsRedraw()},getCurrentStyle:function(){return this._currentStyle},setCurrentStyle:function(t){this._currentStyle.initialize(t)},getIndex:function(){return this._index},getSelectedItems:function(){var t=[];return Base.each(this._selectedItems,function(e){t.push(e)}),t},_updateSelection:function(t){t._selected?(this._selectedItemCount++,this._selectedItems[t.getId()]=t):(this._selectedItemCount--,delete this._selectedItems[t.getId()])},selectAll:function(){for(var t=0,e=this.layers.length;e>t;t++)this.layers[t].setSelected(!0)},deselectAll:function(){for(var t in this._selectedItems)this._selectedItems[t].setSelected(!1)},hitTest:function(t,e){e=HitResult.getOptions(t,e),t=e.point;for(var n=this.layers.length-1;n>=0;n--){var i=this.layers[n].hitTest(t,e);if(i)return i}return null},draw:function(t){t.save();for(var e={offset:new Point(0,0)},n=0,i=this.layers.length;i>n;n++)Item.draw(this.layers[n],t,e);t.restore(),this._selectedItemCount>0&&(t.save(),t.strokeWidth=1,t.strokeStyle=t.fillStyle="#009dec",e={selection:!0},Base.each(this._selectedItems,function(n){n.draw(t,e)}),t.restore())}}),Symbol=this.Symbol=Base.extend({initialize:function(t){this.project=paper.project,this.project.symbols.push(this),this.setDefinition(t),this._instances={}},_changed:function(t){Base.each(this._instances,function(e){e._changed(t)})},getDefinition:function(){return this._definition},setDefinition:function(t){t._parentSymbol&&(t=t.clone()),this._definition&&delete this._definition._parentSymbol,this._definition=t,t.remove(),t.setPosition(new Point),t._parentSymbol=this,this._changed(Change.GEOMETRY)},place:function(t){return new PlacedSymbol(this,t)},clone:function(){return new Symbol(this._definition.clone())}}),ChangeFlag={APPEARANCE:1,HIERARCHY:2,GEOMETRY:4,STROKE:8,STYLE:16,ATTRIBUTE:32,CONTENT:64,PIXELS:128,CLIPPING:256},Change={HIERARCHY:ChangeFlag.HIERARCHY|ChangeFlag.APPEARANCE,GEOMETRY:ChangeFlag.GEOMETRY|ChangeFlag.APPEARANCE,STROKE:ChangeFlag.STROKE|ChangeFlag.STYLE|ChangeFlag.APPEARANCE,STYLE:ChangeFlag.STYLE|ChangeFlag.APPEARANCE,ATTRIBUTE:ChangeFlag.ATTRIBUTE|ChangeFlag.APPEARANCE,CONTENT:ChangeFlag.CONTENT|ChangeFlag.APPEARANCE,PIXELS:ChangeFlag.PIXELS|ChangeFlag.APPEARANCE},Item=this.Item=Base.extend({initialize:function(){this._id=++Item._id,this._project||paper.project.activeLayer.addChild(this),this._style=PathStyle.create(this),this.setStyle(this._project.getCurrentStyle())},_changed:function(t){if(t&ChangeFlag.GEOMETRY&&(delete this._bounds,delete this._position),t&ChangeFlag.APPEARANCE&&this._project._needsRedraw(),this._parentSymbol&&this._parentSymbol._changed(t),this._project._changes){var e=this._project._changesById[this._id];e?e.flags|=t:(e={item:this,flags:t},this._project._changesById[this._id]=e,this._project._changes.push(e))}},getId:function(){return this._id},getName:function(){return this._name},setName:function(t){if(this._name&&this._removeFromNamed(),this._name=t||void 0,t){var e=this._parent._children,n=this._parent._namedChildren;(n[t]=n[t]||[]).push(this),e[t]=this}this._changed(ChangeFlag.ATTRIBUTE)},getPosition:function(){var t=this._position||(this._position=this.getBounds().getCenter());return LinkedPoint.create(this,"setPosition",t._x,t._y)},setPosition:function(t){this.translate(Point.read(arguments).subtract(this.getPosition()))},getStyle:function(){return this._style},setStyle:function(t){this._style.initialize(t)},statics:{_id:0}},new function(){return Base.each(["locked","visible","blendMode","opacity","guide"],function(t){var e=Base.capitalize(t),t="_"+t;this["get"+e]=function(){return this[t]},this["set"+e]=function(e){e!=this[t]&&(this[t]=e,this._changed("_locked"===t?ChangeFlag.ATTRIBUTE:Change.ATTRIBUTE))}},{})},{_locked:!1,_visible:!0,_blendMode:"normal",_opacity:1,_guide:!1,isSelected:function(){if(this._children)for(var t=0,e=this._children.length;e>t;t++)if(this._children[t].isSelected())return!0;return this._selected},setSelected:function(t){if(this._children)for(var e=0,n=this._children.length;n>e;e++)this._children[e].setSelected(t);else(t=!!t)!=this._selected&&(this._selected=t,this._project._updateSelection(this),this._changed(Change.ATTRIBUTE))},_selected:!1,isFullySelected:function(){if(this._children&&this._selected){for(var t=0,e=this._children.length;e>t;t++)if(!this._children[t].isFullySelected())return!1;return!0}return this._selected},setFullySelected:function(t){if(this._children)for(var e=0,n=this._children.length;n>e;e++)this._children[e].setFullySelected(t);this.setSelected(t)},isClipMask:function(){return this._clipMask},setClipMask:function(t){this._clipMask!=(t=!!t)&&(this._clipMask=t,t&&(this.setFillColor(null),this.setStrokeColor(null)),this._changed(Change.ATTRIBUTE),this._parent&&this._parent._changed(ChangeFlag.CLIPPING))},_clipMask:!1,getProject:function(){return this._project},_setProject:function(t){if(this._project!=t&&(this._project=t,this._children))for(var e=0,n=this._children.length;n>e;e++)this._children[e]._setProject(t)},getLayer:function(){for(var t=this;t=t._parent;)if(t instanceof Layer)return t;return null},getParent:function(){return this._parent},getChildren:function(){return this._children},setChildren:function(t){this.removeChildren(),this.addChildren(t)},getFirstChild:function(){return this._children&&this._children[0]||null},getLastChild:function(){return this._children&&this._children[this._children.length-1]||null},getNextSibling:function(){return this._parent&&this._parent._children[this._index+1]||null},getPreviousSibling:function(){return this._parent&&this._parent._children[this._index-1]||null},getIndex:function(){return this._index},clone:function(){return this._clone(new this.constructor)},_clone:function(t){if(t.setStyle(this._style),this._children)for(var e=0,n=this._children.length;n>e;e++)t.addChild(this._children[e].clone());for(var i=["_locked","_visible","_blendMode","_opacity","_clipMask","_guide"],e=0,n=i.length;n>e;e++){var r=i[e];this.hasOwnProperty(r)&&(t[r]=this[r])}return t.setSelected(this._selected),this._name&&t.setName(this._name),t},copyTo:function(t){var e=this.clone();return t.layers?t.activeLayer.addChild(e):t.addChild(e),e},rasterize:function(t){var e=this.getStrokeBounds(),n=(t||72)/72,i=CanvasProvider.getCanvas(e.getSize().multiply(n)),r=i.getContext("2d"),s=(new Matrix).scale(n).translate(-e.x,-e.y);s.applyToContext(r),this.draw(r,{});var o=new Raster(i);return o.setBounds(e),o},hitTest:function(t,e,n){function i(i,r){var a=s["get"+r]().transform(n);return t.getDistance(a)<e.tolerance?new HitResult(i,o,{name:Base.hyphenate(r),point:a}):void 0}if(e=HitResult.getOptions(t,e),t=e.point,!this._children&&!this.getRoughBounds(n).expand(e.tolerance)._containsPoint(t))return null;if((e.center||e.bounds)&&(!(this instanceof Layer)||this._parent)){var r,s=this.getBounds(),o=this,a=["TopLeft","TopRight","BottomLeft","BottomRight","LeftCenter","TopCenter","RightCenter","BottomCenter"];if(e.center&&(r=i("center","Center")))return r;if(e.bounds)for(var u=0;8>u;u++)if(r=i("bounds",a[u]))return r}return this._children||!(e.guides&&!this._guide||e.selected&&!this._selected)?this._hitTest(t,e,n):null},_hitTest:function(t,e,n){if(this._children)for(var i=this._children.length-1;i>=0;i--){var r=this._children[i].hitTest(t,e,n);if(r)return r}},addChild:function(t){return this.insertChild(void 0,t)},insertChild:function(t,e){return this._children?(e._remove(!1,!0),Base.splice(this._children,[e],t,0),e._parent=this,e._setProject(this._project),e._name&&e.setName(e._name),this._changed(Change.HIERARCHY),!0):!1},addChildren:function(t){for(var e=0,n=t&&t.length;n>e;e++)this.insertChild(void 0,t[e])},insertChildren:function(t,e){for(var n=0,i=e&&e.length;i>n;n++)this.insertChild(t,e[n])&&t++},insertAbove:function(t){return t._parent&&t._parent.insertChild(t._index+1,this)},insertBelow:function(t){return t._parent&&t._parent.insertChild(t._index-1,this)},appendTop:function(t){return this.addChild(t)},appendBottom:function(t){return this.insertChild(0,t)},moveAbove:function(t){return this.insertAbove(t)},moveBelow:function(t){return this.insertBelow(t)},_removeFromNamed:function(){var t=this._parent._children,e=this._parent._namedChildren,n=this._name,i=e[n],r=i?i.indexOf(this):-1;-1!=r&&(t[n]==this&&delete t[n],i.splice(r,1),i.length?t[n]=i[i.length-1]:delete e[n])},_remove:function(t,e){return this._parent?(t&&this.setSelected(!1),this._name&&this._removeFromNamed(),Base.splice(this._parent._children,null,this._index,1),e&&this._parent._changed(Change.HIERARCHY),this._parent=null,!0):!1},remove:function(){return this._remove(!0,!0)},removeChildren:function(t,e){if(!this._children)return null;t=t||0,e=Base.pick(e,this._children.length);for(var n=this._children.splice(t,e-t),i=n.length-1;i>=0;i--)n[i]._remove(!0,!1);return n.length>0&&this._changed(Change.HIERARCHY),n},reverseChildren:function(){if(this._children){this._children.reverse();for(var t=0,e=this._children.length;e>t;t++)this._children[t]._index=t;this._changed(Change.HIERARCHY)}},isEditable:function(){for(var t=this;t;){if(!t._visible||t._locked)return!1;t=t._parent}return!0},_getOrder:function(t){function e(t){var e=[];do e.unshift(t);while(t=t._parent);return e}for(var n=e(this),i=e(t),r=0,s=Math.min(n.length,i.length);s>r;r++)if(n[r]!=i[r])return n[r]._index<i[r]._index?1:-1;return 0},hasChildren:function(){return this._children&&this._children.length>0},isAbove:function(t){return-1==this._getOrder(t)},isBelow:function(t){return 1==this._getOrder(t)},isParent:function(t){return this._parent==t},isChild:function(t){return t&&t._parent==this},isDescendant:function(t){for(var e=this;e=e._parent;)if(e==t)return!0;return!1},isAncestor:function(t){return t?t.isDescendant(this):!1},isGroupedWith:function(t){for(var e=this._parent;e;){if(e._parent&&(e instanceof Group||e instanceof CompoundPath)&&t.isDescendant(e))return!0;e=e._parent}return!1},_getBounds:function(t,e,n){var i=this._children;if(!i||0==i.length)return new Rectangle;for(var r=1/0,s=-r,o=r,a=s,u=0,h=i.length;h>u;u++){var l=i[u];if(l._visible){var c=l[t](n[0]);r=Math.min(c.x,r),o=Math.min(c.y,o),s=Math.max(c.x+c.width,s),a=Math.max(c.y+c.height,a)}}var d=Rectangle.create(r,o,s-r,a-o);return"getBounds"==t?this._createBounds(d):d},_createBounds:function(t){return LinkedRectangle.create(this,"setBounds",t.x,t.y,t.width,t.height)},getBounds:function(){return this._getBounds("getBounds","_bounds",arguments)},setBounds:function(t){t=Rectangle.read(arguments);var e=this.getBounds(),n=new Matrix,i=t.getCenter();n.translate(i),(t.width!=e.width||t.height!=e.height)&&n.scale(0!=e.width?t.width/e.width:1,0!=e.height?t.height/e.height:1),i=e.getCenter(),n.translate(-i.x,-i.y),this.transform(n)},getStrokeBounds:function(){return this._getBounds("getStrokeBounds","_strokeBounds",arguments)},getHandleBounds:function(){return this._getBounds("getHandleBounds","_handleBounds",arguments)},getRoughBounds:function(){return this._getBounds("getRoughBounds","_roughBounds",arguments)},scale:function(t,e,n){return(arguments.length<2||"object"==typeof e)&&(n=e,e=t),this.transform((new Matrix).scale(t,e,n||this.getPosition()))},translate:function(t){var e=new Matrix;return this.transform(e.translate.apply(e,arguments))},rotate:function(t,e){return this.transform((new Matrix).rotate(t,e||this.getPosition()))},shear:function(t,e,n){return(arguments.length<2||"object"==typeof e)&&(n=e,e=t),this.transform((new Matrix).shear(t,e,n||this.getPosition()))},transform:function(t,e){var n=this._bounds,i=this._position,r=this._children;this._transform&&(this._transform(t,e),this._changed(Change.GEOMETRY)),n&&t.getRotation()%90===0?(this._bounds=this._createBounds(t._transformBounds(n)),this._position=this._bounds.getCenter()):i&&(this._position=t._transformPoint(i,i,!0));for(var s=0,o=r&&r.length;o>s;s++)r[s].transform(t,e);return this},fitBounds:function(t,e){t=Rectangle.read(arguments);var n=this.getBounds(),i=n.height/n.width,r=t.height/t.width,s=(e?i>r:r>i)?t.width/n.width:t.height/n.height,o=(t.getCenter().subtract(n.getCenter()),new Rectangle(new Point,new Size(n.width*s,n.height*s)));o.setCenter(t.getCenter()),this.setBounds(o)},toString:function(){return(this.constructor._name||"Item")+(this._name?" '"+this._name+"'":" @"+this._id)},statics:{drawSelectedBounds:function(t,e,n){var i=n._transformCorners(t);e.beginPath();for(var r=0;8>r;r++)e[0==r?"moveTo":"lineTo"](i[r],i[++r]);e.closePath(),e.stroke();for(var r=0;8>r;r++)e.beginPath(),e.rect(i[r]-2,i[++r]-2,4,4),e.fill()},draw:function(t,e,n){if(t._visible&&0!=t._opacity){var i,r;if("normal"!==t._blendMode||t._opacity<1&&(!t._segments||t.getFillColor()&&t.getStrokeColor())){var s=t.getStrokeBounds()||t.getBounds();if(!s.width||!s.height)return;var o=s.getTopLeft().floor(),a=s.getSize().ceil().add(new Size(1,1));i=CanvasProvider.getCanvas(a),r=e,e=i.getContext("2d"),e.save(),e.translate(-o.x,-o.y)}var u;if(o&&(u=n.offset,n.offset=o),t.draw(e,n),o&&(n.offset=u),i){if(e.restore(),"normal"!==t._blendMode){var h=o.subtract(n.offset);BlendMode.process(t._blendMode,e,r,t._opacity,h)}else r.save(),r.globalAlpha=t._opacity,r.drawImage(i,o.x,o.y),r.restore();CanvasProvider.returnCanvas(i)}}}}},new function(){function t(t){for(var e in t){var i=t[e];i.remove();for(var r in n){var s=n[r];s!=t&&s[i.getId()]&&delete s[i.getId()]}}}function e(e){var i="onMouse"+Base.capitalize(e),r=paper.tool[i];if(!r||!r._installed){var s={};s[i]=function(i){"up"===e&&(n.drag={}),t(n[e]),n[e]={},this.base&&this.base(i)},paper.tool.inject(s),paper.tool[i]._installed=!0}}var n={down:{},drag:{},up:{},move:{}};return Base.each(["down","drag","up","move"],function(t){this["removeOn"+Base.capitalize(t)]=function(){var e={};return e[t]=!0,this.removeOn(e)}},{removeOn:function(t){for(var i in t)t[i]&&(n[i][this.getId()]=this,"drag"===i&&e("up"),e(i));return this}})}),Group=this.Group=Item.extend({initialize:function(t){this.base(),this._children=[],this._namedChildren={},this.addChildren(t&&Array.isArray(t)&&"object"==typeof t[0]?t:arguments)},_changed:function(t){Item.prototype._changed.call(this,t),t&(ChangeFlag.HIERARCHY|ChangeFlag.CLIPPING)&&delete this._clipItem},_getClipItem:function(){if(void 0!==this._clipItem)return this._clipItem;for(var t=0,e=this._children.length;e>t;t++){var n=this._children[t];if(n._clipMask)return this._clipItem=n}return this._clipItem=null},isClipped:function(){return!!this._getClipItem()},setClipped:function(t){var e=this.getFirstChild();return e&&e.setClipMask(t),this},draw:function(t,e){var n=this._getClipItem();n&&Item.draw(n,t,e);for(var i=0,r=this._children.length;r>i;i++){var s=this._children[i];s!=n&&Item.draw(s,t,e)}}}),Layer=this.Layer=Group.extend({initialize:function(t){this._project=paper.project,this._index=this._project.layers.push(this)-1,this.base.apply(this,arguments),this.activate()},_remove:function(t,e){return this._parent?this.base(t,e):null!=this._index?(t&&this.setSelected(!1),Base.splice(this._project.layers,null,this._index,1),this._project._needsRedraw(),!0):!1},getNextSibling:function(){return this._parent?this.base():this._project.layers[this._index+1]||null},getPreviousSibling:function(){return this._parent?this.base():this._project.layers[this._index-1]||null},activate:function(){this._project.activeLayer=this}},new function(){function t(t){return function(e){return e instanceof Layer&&!e._parent&&this._remove(!1,!0)?(Base.splice(e._project.layers,[this],e._index+(t?1:-1),0),this._setProject(e._project),!0):this.base(e)}}return{insertAbove:t(!0),insertBelow:t(!1)}}),PlacedItem=this.PlacedItem=Item.extend({_transform:function(t,e){this._matrix.preConcatenate(t)},_changed:function(t){Item.prototype._changed.call(this,t),t&ChangeFlag.GEOMETRY&&(delete this._strokeBounds,delete this._handleBounds,delete this._roughBounds)},getMatrix:function(){return this._matrix},setMatrix:function(t){this._matrix=t.clone(),this._changed(Change.GEOMETRY)},getBounds:function(){var t=void 0===arguments[0];if(t&&this._bounds)return this._bounds;var e=this.getStrokeBounds(arguments[0]);return t&&(e=this._bounds=this._createBounds(e)),e},_getBounds:function(t,e,n){var i=n[0],r=void 0===i;if(r&&this[e])return this[e];i=i?i.clone().concatenate(this._matrix):this._matrix;var s=this._calculateBounds(t,i);return r&&(this[e]=s),s}}),Raster=this.Raster=PlacedItem.extend({initialize:function(t){this.base(),t.getContext?this.setCanvas(t):("string"==typeof t&&(t=document.getElementById(t)),this.setImage(t)),this._matrix=new Matrix},clone:function(){var t=this._image;t||(t=CanvasProvider.getCanvas(this._size),t.getContext("2d").drawImage(this._canvas,0,0));var e=new Raster(t);return e._matrix=this._matrix.clone(),this._clone(e)},getSize:function(){return this._size},setSize:function(){var t=Size.read(arguments),e=this.getImage();this.setCanvas(CanvasProvider.getCanvas(t)),this.getContext(!0).drawImage(e,0,0,t.width,t.height)},getWidth:function(){return this._size.width},getHeight:function(){return this._size.height},getPpi:function(){var t=this._matrix,e=new Point(0,0).transform(t),n=new Point(1,0).transform(t).subtract(e),i=new Point(0,1).transform(t).subtract(e);return new Size(72/n.getLength(),72/i.getLength())},getContext:function(){return this._context||(this._context=this.getCanvas().getContext("2d")),arguments[0]&&this._changed(Change.PIXELS),this._context},setContext:function(t){this._context=t},getCanvas:function(){return this._canvas||(this._canvas=CanvasProvider.getCanvas(this._size),this._image&&this.getContext(!0).drawImage(this._image,0,0)),this._canvas},setCanvas:function(t){this._canvas&&CanvasProvider.returnCanvas(this._canvas),this._canvas=t,this._size=new Size(t.width,t.height),this._image=null,this._context=null,this._changed(Change.GEOMETRY)},getImage:function(){return this._image||this.getCanvas()},setImage:function(t){this._canvas&&CanvasProvider.returnCanvas(this._canvas),this._image=t,this._size=new Size(t.naturalWidth,t.naturalHeight),this._canvas=null,this._context=null,this._changed(Change.GEOMETRY)},getSubImage:function(t){t=Rectangle.read(arguments);var e=CanvasProvider.getCanvas(t.getSize());return e.getContext("2d").drawImage(this.getCanvas(),t.x,t.y,e.width,e.height,0,0,e.width,e.height),e},drawImage:function(t,e){e=Point.read(arguments,1),this.getContext(!0).drawImage(t,e.x,e.y)},getAverageColor:function(t){t||(t=this.getBounds());var e,n;t instanceof PathItem?(n=t,e=t.getBounds()):t.width?e=new Rectangle(t):t.x&&(e=Rectangle.create(t.x-.5,t.y-.5,1,1));var i=32,r=Math.min(e.width,i),s=Math.min(e.height,i),o=Raster._sampleContext;o?o.clearRect(0,0,i,i):o=Raster._sampleContext=CanvasProvider.getCanvas(new Size(i)).getContext("2d"),o.save(),o.scale(r/e.width,s/e.height),o.translate(-e.x,-e.y),n&&n.draw(o,{clip:!0}),this._matrix.applyToContext(o),o.drawImage(this._canvas||this._image,-this._size.width/2,-this._size.height/2),o.restore();for(var a=o.getImageData(.5,.5,Math.ceil(r),Math.ceil(s)).data,u=[0,0,0],h=0,l=0,c=a.length;c>l;l+=4){var d=a[l+3];h+=d,d/=255,u[0]+=a[l]*d,u[1]+=a[l+1]*d,u[2]+=a[l+2]*d}for(var l=0;3>l;l++)u[l]/=h;return h?Color.read(u):null},getPixel:function(t){t=Point.read(arguments);for(var e=this.getContext().getImageData(t.x,t.y,1,1).data,n=new Array(4),i=0;4>i;i++)n[i]=e[i]/255;return RgbColor.read(n)},setPixel:function(t,e){var n=2==arguments.length;t=Point.read(arguments,0,n?1:2),e=Color.read(arguments,n?1:2);var i=this.getContext(!0),r=i.createImageData(1,1),s=e.getAlpha();r.data[0]=255*e.getRed(),r.data[1]=255*e.getGreen(),r.data[2]=255*e.getBlue(),r.data[3]=null!=s?255*s:255,i.putImageData(r,t.x,t.y)},createData:function(t){return t=Size.read(arguments),this.getContext().createImageData(t.width,t.height)},getData:function(t){return t=Rectangle.read(arguments),t.isEmpty()&&(t=new Rectangle(this.getSize())),this.getContext().getImageData(t.x,t.y,t.width,t.height)},setData:function(t,e){e=Point.read(arguments,1),this.getContext(!0).putImageData(t,e.x,e.y)},_calculateBounds:function(t,e){return e._transformBounds(new Rectangle(this._size).setCenter(0,0))},getHandleBounds:function(){return this.getStrokeBounds(arguments[0])},getRoughBounds:function(){return this.getStrokeBounds(arguments[0])},draw:function(t,e){if(e.selection){var n=new Rectangle(this._size).setCenter(0,0);Item.drawSelectedBounds(n,t,this._matrix)}else t.save(),this._matrix.applyToContext(t),t.drawImage(this._canvas||this._image,-this._size.width/2,-this._size.height/2),t.restore()}}),PlacedSymbol=this.PlacedSymbol=PlacedItem.extend({initialize:function(t,e){this.base(),this.setSymbol(t instanceof Symbol?t:new Symbol(t)),this._matrix=void 0!==e?e instanceof Matrix?e:(new Matrix).translate(Point.read(arguments,1)):new Matrix},getSymbol:function(){return this._symbol},setSymbol:function(t){this._symbol&&delete this._symbol._instances[this._id],this._symbol=t,t._instances[this._id]=this},clone:function(){return this._clone(new PlacedSymbol(this.symbol,this._matrix.clone()))},_calculateBounds:function(t,e){return this.symbol._definition[t](e)},draw:function(t,e){e.selection?Item.drawSelectedBounds(this.symbol._definition.getStrokeBounds(),t,this._matrix):(t.save(),this._matrix.applyToContext(t),Item.draw(this.symbol.getDefinition(),t,e),t.restore())}});HitResult=Base.extend({initialize:function(t,e,n){this.type=t,this.item=e,n&&Base.each(n,function(t,e){this[e]=t},this)},statics:{getOptions:function(t,e){return e&&e._merged?e:Base.merge({point:Point.read(arguments,0,1),type:null,tolerance:2,fill:!e,stroke:!e,segments:!e,handles:!1,ends:!1,center:!1,bounds:!1,guides:!1,selected:!1,_merged:!0},e)}}});var Segment=this.Segment=Base.extend({initialize:function(t,e,n,i,r,s){var o,a,u,h=arguments.length,l=SegmentPoint.create;0==h||(1==h?t.point?(o=t.point,a=t.handleIn,u=t.handleOut):o=t:6>h?2==h&&void 0===e.x?o=[t,e]:(o=t,a=e,u=n):6==h&&(o=[t,e],a=[n,i],u=[r,s])),l(this,"_point",o),l(this,"_handleIn",a),l(this,"_handleOut",u)},_changed:function(t){if(this._path){var e,n=this._path._curves&&this.getCurve();n&&(n._changed(),(e=n[t==this._point||t==this._handleIn&&n._segment1==this?"getPrevious":"getNext"]())&&e._changed()),this._path._changed(Change.GEOMETRY)}},getPoint:function(){return this._point},setPoint:function(t){t=Point.read(arguments),this._point.set(t.x,t.y)},getHandleIn:function(){return this._handleIn},setHandleIn:function(t){t=Point.read(arguments),this._handleIn.set(t.x,t.y)},getHandleOut:function(){return this._handleOut},setHandleOut:function(t){t=Point.read(arguments),this._handleOut.set(t.x,t.y)},_isSelected:function(t){var e=this._selectionState;return t==this._point?!!(e&SelectionState.POINT):t==this._handleIn?!!(e&SelectionState.HANDLE_IN):t==this._handleOut?!!(e&SelectionState.HANDLE_OUT):!1},_setSelected:function(t,e){var n=this._path,e=!!e,i=this._selectionState||0,r=[!!(i&SelectionState.POINT),!!(i&SelectionState.HANDLE_IN),!!(i&SelectionState.HANDLE_OUT)];if(t==this._point){if(e)r[1]=r[2]=!1;else{var s=this.getPrevious(),o=this.getNext();r[1]=s&&(s._point.isSelected()||s._handleOut.isSelected()),r[2]=o&&(o._point.isSelected()||o._handleIn.isSelected())}r[0]=e}else{var a=t==this._handleIn?1:2;r[a]!=e&&(e&&(r[0]=!1),r[a]=e,n._changed(Change.ATTRIBUTE))}this._selectionState=(r[0]?SelectionState.POINT:0)|(r[1]?SelectionState.HANDLE_IN:0)|(r[2]?SelectionState.HANDLE_OUT:0),n&&i!=this._selectionState&&n._updateSelection(this,i,this._selectionState)},isSelected:function(){return this._isSelected(this._point)},setSelected:function(t){this._setSelected(this._point,t)},getIndex:function(){return void 0!==this._index?this._index:null},getPath:function(){return this._path||null},getCurve:function(){if(this._path){var t=this._index;return this._path._closed||t!=this._path._segments.length-1||t--,this._path.getCurves()[t]||null}return null},getNext:function(){var t=this._path&&this._path._segments;return t&&(t[this._index+1]||this._path._closed&&t[0])||null},getPrevious:function(){var t=this._path&&this._path._segments;return t&&(t[this._index-1]||this._path._closed&&t[t.length-1])||null},reverse:function(){return new Segment(this._point,this._handleOut,this._handleIn)},remove:function(){return this._path?!!this._path.removeSegment(this._index):!1},toString:function(){var t=["point: "+this._point];return this._handleIn.isZero()||t.push("handleIn: "+this._handleIn),this._handleOut.isZero()||t.push("handleOut: "+this._handleOut),"{ "+t.join(", ")+" }"},_transformCoordinates:function(t,e,n){var i=this._point,r=n&&this._handleIn.isZero()?null:this._handleIn,s=n&&this._handleOut.isZero()?null:this._handleOut,o=i._x,a=i._y,u=2;e[0]=o,e[1]=a,r&&(e[u++]=r._x+o,e[u++]=r._y+a),s&&(e[u++]=s._x+o,e[u++]=s._y+a),t&&(t._transformCoordinates(e,0,e,0,u/2),o=e[0],a=e[1],n?(i._x=o,i._y=a,u=2,r&&(r._x=e[u++]-o,r._y=e[u++]-a),s&&(s._x=e[u++]-o,s._y=e[u++]-a)):(r||(e[u++]=o,e[u++]=a),s||(e[u++]=o,e[u++]=a)))}}),SegmentPoint=Point.extend({set:function(t,e){return this._x=t,this._y=e,this._owner._changed(this),this},getX:function(){return this._x},setX:function(t){this._x=t,this._owner._changed(this)},getY:function(){return this._y},setY:function(t){this._y=t,this._owner._changed(this)},isZero:function(){return 0==this._x&&0==this._y},setSelected:function(t){this._owner._setSelected(this,t)},isSelected:function(){return this._owner._isSelected(this)},statics:{create:function(t,e,n){var i,r,s,o=new SegmentPoint(SegmentPoint.dont);return n?void 0!==(i=n[0])?r=n[1]:(void 0===(i=n.x)&&(n=Point.read(arguments,2,1),i=n.x),r=n.y,s=n.selected):i=r=0,o._x=i,o._y=r,o._owner=t,t[e]=o,s&&o.setSelected(!0),o}}}),SelectionState={HANDLE_IN:1,HANDLE_OUT:2,POINT:4},Curve=this.Curve=Base.extend({initialize:function(t,e,n,i,r,s,o,a){var u=arguments.length;if(0==u)this._segment1=new Segment,this._segment2=new Segment;else if(1==u)this._segment1=new Segment(t.segment1),this._segment2=new Segment(t.segment2);else if(2==u)this._segment1=new Segment(t),this._segment2=new Segment(e);else if(4==u)this._segment1=new Segment(t,null,e),this._segment2=new Segment(i,n,null);else if(8==u){var h=Point.create(t,e),l=Point.create(o,a);this._segment1=new Segment(h,null,Point.create(n,i).subtract(h)),this._segment2=new Segment(l,Point.create(r,s).subtract(l),null)}},_changed:function(){delete this._length},getPoint1:function(){return this._segment1._point},setPoint1:function(t){t=Point.read(arguments),this._segment1._point.set(t.x,t.y)},getPoint2:function(){return this._segment2._point},setPoint2:function(t){t=Point.read(arguments),this._segment2._point.set(t.x,t.y)},getHandle1:function(){return this._segment1._handleOut},setHandle1:function(t){t=Point.read(arguments),this._segment1._handleOut.set(t.x,t.y)},getHandle2:function(){return this._segment2._handleIn},setHandle2:function(t){t=Point.read(arguments),this._segment2._handleIn.set(t.x,t.y)},getSegment1:function(){return this._segment1},getSegment2:function(){return this._segment2},getPath:function(){return this._path},getIndex:function(){return this._segment1._index},getNext:function(){var t=this._path&&this._path._curves;return t&&(t[this._segment1._index+1]||this._path._closed&&t[0])||null},getPrevious:function(){var t=this._path&&this._path._curves;return t&&(t[this._segment1._index-1]||this._path._closed&&t[t.length-1])||null},isSelected:function(){return this.getHandle1().isSelected()&&this.getHandle2().isSelected()},setSelected:function(t){this.getHandle1().setSelected(t),this.getHandle2().setSelected(t)},getValues:function(t){return Curve.getValues(this._segment1,this._segment2,t)},getPoints:function(t){for(var e=this.getValues(t),n=[],i=0;8>i;i+=2)n.push(Point.create(e[i],e[i+1]));return n},getLength:function(){var t=arguments[0],e=arguments[1];if(fullLength=0==arguments.length||0==t&&1==e,fullLength&&null!=this._length)return this._length;var n=Curve.getLength(this.getValues(),t,e);return fullLength&&(this._length=n),n},getPart:function(t,e){return new Curve(Curve.getPart(this.getValues(),t,e))},isLinear:function(){return this._segment1._handleOut.isZero()&&this._segment2._handleIn.isZero()},getParameterAt:function(t,e){return Curve.getParameterAt(this.getValues(),t,void 0!==e?e:0>t?1:0)},getPoint:function(t){return Curve.evaluate(this.getValues(),t,0)},getTangent:function(t){return Curve.evaluate(this.getValues(),t,1)},getNormal:function(t){return Curve.evaluate(this.getValues(),t,2)},getParameter:function(t){return t=Point.read(t),Curve.getParameter(this.getValues(),t.x,t.y)},getCrossings:function(t,e,n){for(var i=this.getValues(e),r=Curve.solveCubic(i,1,t.y,n),s=0,o=0;r>o;o++){var a=n[o];if(a>=0&&1>a&&Curve.evaluate(i,a,0).x>t.x){if(a<Numerical.TOLERANCE&&Curve.evaluate(this.getPrevious().getValues(e),1,1).y*Curve.evaluate(i,a,1).y>=0)continue;s++}}return s},reverse:function(){return new Curve(this._segment2.reverse(),this._segment1.reverse())},clone:function(){return new Curve(this._segment1,this._segment2)},toString:function(){var t=["point1: "+this._segment1._point];return this._segment1._handleOut.isZero()||t.push("handle1: "+this._segment1._handleOut),this._segment2._handleIn.isZero()||t.push("handle2: "+this._segment2._handleIn),t.push("point2: "+this._segment2._point),"{ "+t.join(", ")+" }"},statics:{create:function(t,e,n){var i=new Curve(Curve.dont);return i._path=t,i._segment1=e,i._segment2=n,i},getValues:function(t,e,n){var i=t._point,r=t._handleOut,s=e._handleIn,o=e._point,a=[i._x,i._y,i._x+r._x,i._y+r._y,o._x+s._x,o._y+s._y,o._x,o._y];return n?n._transformCoordinates(a,0,a,0,4):a},evaluate:function(t,e,n){var i,r,s=t[0],o=t[1],a=t[2],u=t[3],h=t[4],l=t[5],c=t[6],d=t[7];if(0!=n||0!=e&&1!=e){var f=Numerical.TOLERANCE;f>e&&a==s&&u==o?e=f:e>1-f&&h==c&&l==d&&(e=1-f);var g=3*(a-s),p=3*(h-a)-g,_=c-s-g-p,m=3*(u-o),v=3*(l-u)-m,y=d-o-m-v;switch(n){case 0:i=((_*e+p)*e+g)*e+s,r=((y*e+v)*e+m)*e+o;break;case 1:case 2:i=(3*_*e+2*p)*e+g,r=(3*y*e+2*v)*e+m}}else i=0==e?s:c,r=0==e?o:d;return 2==n?new Point(r,-i):new Point(i,r)},subdivide:function(t,e){var n=t[0],i=t[1],r=t[2],s=t[3],o=t[4],a=t[5],u=t[6],h=t[7];void 0===e&&(e=.5);var l=1-e,c=l*n+e*r,d=l*i+e*s,f=l*r+e*o,g=l*s+e*a,p=l*o+e*u,_=l*a+e*h,m=l*c+e*f,v=l*d+e*g,y=l*f+e*p,w=l*g+e*_,x=l*m+e*y,P=l*v+e*w;return[[n,i,c,d,m,v,x,P],[x,P,y,w,p,_,u,h]]},solveCubic:function(t,e,n,i){var r=t[e],s=t[e+2],o=t[e+4],a=t[e+6],u=3*(s-r),h=3*(o-s)-u,l=a-r-u-h;return Numerical.solveCubic(l,h,u,r-n,i,Numerical.TOLERANCE)},getParameter:function(t,e,n){for(var i,r,s=[],o=[],a=Curve.solveCubic(t,0,e,s),u=Curve.solveCubic(t,1,n,o),h=0;-1==a||a>h;)if(-1==a||(i=s[h++])>=0&&1>=i){for(var l=0;-1==u||u>l;)if((-1==u||(r=o[l++])>=0&&1>=r)&&(-1==a?i=r:-1==u&&(r=i),Math.abs(i-r)<Numerical.TOLERANCE))return.5*(i+r);if(-1==a)break}return null},getPart:function(t,e,n){return e>0&&(t=Curve.subdivide(t,e)[1]),1>n&&(t=Curve.subdivide(t,(n-e)/(1-e))[0]),t},isFlatEnough:function(t){var e=t[0],n=t[1],i=t[2],r=t[3],s=t[4],o=t[5],a=t[6],u=t[7],h=n-u,l=a-e,c=e*u-a*n,d=h*i+l*r+c,f=h*s+l*o+c;return Math.abs((d*d+f*f)/(h*(h*h+l*l)))<.005}}},new function(){function t(t){var e=t[0],n=t[1],i=t[2],r=t[3],s=t[4],o=t[5],a=t[6],u=t[7],h=9*(i-s)+3*(a-e),l=6*(e+s)-12*i,c=3*(i-e),d=9*(r-o)+3*(u-n),f=6*(n+o)-12*r,g=3*(r-n);return function(t){var e=(h*t+l)*t+c,n=(d*t+f)*t+g;return Math.sqrt(e*e+n*n)}}function e(t,e){return Math.max(2,Math.min(16,Math.ceil(32*Math.abs(e-t))))}return{statics:!0,getLength:function(n,i,r){if(void 0===i&&(i=0),void 0===r&&(r=1),n[0]==n[2]&&n[1]==n[3]&&n[6]==n[4]&&n[7]==n[5]){var s=n[6]-n[0],o=n[7]-n[1];return(r-i)*Math.sqrt(s*s+o*o)}var a=t(n);return Numerical.integrate(a,i,r,e(i,r))},getParameterAt:function(n,i,r){function s(t){var n=e(r,t);return d+=t>r?Numerical.integrate(h,r,t,n):-Numerical.integrate(h,t,r,n),r=t,d-i}if(0==i)return r;var o=i>0,a=o?r:0,u=o?1:r,i=Math.abs(i),h=t(n),l=Numerical.integrate(h,a,u,e(a,u));if(i>=l)return o?u:a;var c=i/l,d=0;return Numerical.findRoot(s,h,o?a+c:u-c,a,u,16,Numerical.TOLERANCE)}}},new function(){function t(t,e){for(var n=3,i=5,r=[],s=[],a=[],u=[],h=0;n>=h;h++)r[h]=t[h].subtract(e),n>h&&(s[h]=t[h+1].subtract(t[h]).multiply(n));   for(var l=0;n>l;l++){a[l]=[];for(var c=0;n>=c;c++)a[l][c]=s[l].dot(r[c])}for(var h=0;i>=h;h++)u[h]=new Point(h/i,0);for(k=0;k<=i;k++)for(var d=Math.max(0,k-n+1),f=Math.min(k,n),h=d;f>=h;h++){var g=k-h;u[k].y+=a[g][h]*o[g][h]}return u}function e(t,s){switch(n(t)){case 0:return[];case 1:if(s>=r)return[.5*(t[0].x+t[5].x)];if(i(t)){var o=new Line(t[0],t[5],!0);return[o.vector.getLength(!0)<=Numerical.EPSILON?o.point.x:a.intersect(o).x]}}for(var u=[[]],h=[],l=[],c=0;5>=c;c++)u[0][c]=new Point(t[c]);for(var d=1;5>=d;d++){u[d]=[];for(var c=0;5-d>=c;c++)u[d][c]=u[d-1][c].add(u[d-1][c+1]).multiply(.5)}for(var c=0;5>=c;c++)h[c]=u[c][0],l[c]=u[5-c][c];return e(h,s+1).concat(e(l,s+1))}function n(t){for(var e=0,n=null,i=0,r=t.length;r>i;i++){var s=t[i].y<0?-1:1;null!=n&&s!=n&&e++,n=s}return e}function i(t){for(var e=t.length-1,n=t[0].y-t[e].y,i=t[e].x-t[0].x,r=t[0].x*t[e].y-t[e].x*t[0].y,o=0,a=0,u=1;e>u;u++){var h=n*t[u].x+i*t[u].y+r,l=h*h;0>h&&l>a?a=l:l>o&&(o=l)}return Math.abs((o+a)/(2*n*(n*n+i*i)))<s}var r=32,s=Math.pow(2,-r-1),o=[[1,.6,.3,.1],[.4,.6,.6,.4],[.1,.3,.6,1]],a=new Line(new Point(0,0),new Point(1,0));return{getNearestLocation:function(n,i){for(var r,s,o=t(this.getPoints(i),n),a=e(o,0).concat([0,1]),u=1/0,h=0;h<a.length;h++){var l=this.getPoint(a[h]),c=n.getDistance(l,!0);u>c&&(u=c,r=a[h],s=l)}return new CurveLocation(this,r,s,Math.sqrt(u))},getNearestPoint:function(t,e){return this.getNearestLocation(t,e).getPoint()}}});CurveLocation=Base.extend({initialize:function(t,e,n,i){this._curve=t,this._parameter=e,this._point=n,this._distance=i},getSegment:function(){if(!this._segment){var t=this._curve,e=this.getParameter();if(0==e)this._segment=t._segment1;else if(1==e)this._segment=t._segment2;else{if(null==e)return null;this._segment=t.getLength(0,e)<t.getLength(e,1)?t._segment1:t._segment2}}return this._segment},getCurve:function(){return this._curve},getPath:function(){return this._curve&&this._curve._path},getIndex:function(){return this._curve&&this._curve.getIndex()},getOffset:function(){var t=this._curve&&this._curve._path;return t&&t._getOffset(this)},getCurveOffset:function(){var t=this.getParameter();return null!=t&&this._curve&&this._curve.getLength(0,t)},getParameter:function(){return null==this._parameter&&this._curve&&this._point&&(this._parameter=this._curve.getParameterAt(this._point)),this._parameter},getPoint:function(){return!this._point&&this._curve&&null!=this._parameter&&(this._point=this._curve.getPoint(this._parameter)),this._point},getTangent:function(){var t=this.getParameter();return null!=t&&this._curve&&this._curve.getTangent(t)},getNormal:function(){var t=this.getParameter();return null!=t&&this._curve&&this._curve.getNormal(t)},getDistance:function(){return this._distance},toString:function(){var t=[],e=this.getPoint();e&&t.push("point: "+e);var n=this.getIndex();null!=n&&t.push("index: "+n);var i=this.getParameter();return null!=i&&t.push("parameter: "+Base.formatNumber(i)),null!=this._distance&&t.push("distance: "+Base.formatNumber(this._distance)),"{ "+t.join(", ")+" }"}});var PathItem=this.PathItem=Item.extend({}),Path=this.Path=PathItem.extend({initialize:function(t){this.base(),this._closed=!1,this._selectedSegmentState=0,this.setSegments(t&&Array.isArray(t)&&"object"==typeof t[0]?t:arguments)},clone:function(){var t=this._clone(new Path(this._segments));return t._closed=this._closed,void 0!==this._clockwise&&(t._clockwise=this._clockwise),t},_changed:function(t){Item.prototype._changed.call(this,t),t&ChangeFlag.GEOMETRY?(delete this._strokeBounds,delete this._handleBounds,delete this._roughBounds,delete this._length,delete this._clockwise):t&ChangeFlag.STROKE&&delete this._strokeBounds},getSegments:function(){return this._segments},setSegments:function(t){this._segments?(this._selectedSegmentState=0,this._segments.length=0,this._curves&&delete this._curves):this._segments=[],this._add(Segment.readAll(t))},getFirstSegment:function(){return this._segments[0]},getLastSegment:function(){return this._segments[this._segments.length-1]},getCurves:function(){if(!this._curves){var t=this._segments,e=t.length;!this._closed&&e>0&&e--,this._curves=new Array(e);for(var n=0;e>n;n++)this._curves[n]=Curve.create(this,t[n],t[n+1]||t[0])}return this._curves},getFirstCurve:function(){return this.getCurves()[0]},getLastCurve:function(){var t=this.getCurves();return t[t.length-1]},getClosed:function(){return this._closed},setClosed:function(t){if(this._closed!=(t=!!t)){if(this._closed=t,this._curves){var e,n=this._segments.length;!t&&n>0&&n--,this._curves.length=n,t&&(this._curves[e=n-1]=Curve.create(this,this._segments[e],this._segments[0]))}this._changed(Change.GEOMETRY)}},_transform:function(t,e){if(!t.isIdentity()){for(var n=new Array(6),i=0,r=this._segments.length;r>i;i++)this._segments[i]._transformCoordinates(t,n,!0);var s=this.getFillColor(),o=this.getStrokeColor();s&&s.transform&&s.transform(t),o&&o.transform&&o.transform(t)}},_add:function(t,e){for(var n=this._segments,i=this._curves,r=t.length,s=null==e,e=s?n.length:e,o=this.isFullySelected(),a=0;r>a;a++){var u=t[a];u._path&&(u=t[a]=new Segment(u)),u._path=this,u._index=e+a,o&&(u._selectionState=SelectionState.POINT),u._selectionState&&this._updateSelection(u,0,u._selectionState)}if(s)n.push.apply(n,t);else{n.splice.apply(n,[e,0].concat(t));for(var a=e+r,h=n.length;h>a;a++)n[a]._index=a}if(i&&--e>=0){i.splice(e,0,Curve.create(this,n[e],n[e+1]));var l=i[e+r];l&&(l._segment1=n[e+r])}return this._changed(Change.GEOMETRY),t},add:function(t){return arguments.length>1&&"number"!=typeof t?this._add(Segment.readAll(arguments)):this._add([Segment.read(arguments)])[0]},insert:function(t,e){return arguments.length>2&&"number"!=typeof e?this._add(Segment.readAll(arguments,1),t):this._add([Segment.read(arguments,1)],t)[0]},addSegment:function(t){return this._add([Segment.read(arguments)])[0]},insertSegment:function(t,e){return this._add([Segment.read(arguments,1)],t)[0]},addSegments:function(t){return this._add(Segment.readAll(t))},insertSegments:function(t,e){return this._add(Segment.readAll(e),t)},removeSegment:function(t){var e=this.removeSegments(t,t+1);return e[0]||null},removeSegments:function(t,e){t=t||0,e=Base.pick(e,this._segments.length);var n=this._segments,i=this._curves,r=e>=n.length,s=n.splice(t,e-t),o=s.length;if(!o)return s;for(var a=0;o>a;a++){var u=s[a];u._selectionState&&this._updateSelection(u,u._selectionState,0),s._index=s._path=void 0}for(var a=t,h=n.length;h>a;a++)n[a]._index=a;if(i){i.splice(t,o);var l;(l=i[t-1])&&(l._segment2=n[t]),(l=i[t])&&(l._segment1=n[t]),r&&this._closed&&(l=i[i.length-1])&&(l._segment2=n[0])}return this._changed(Change.GEOMETRY),s},isFullySelected:function(){return this._selected&&this._selectedSegmentState==this._segments.length*SelectionState.POINT},setFullySelected:function(t){var e=this._segments.length;this._selectedSegmentState=t?e*SelectionState.POINT:0;for(var n=0;e>n;n++)this._segments[n]._selectionState=t?SelectionState.POINT:0;this.setSelected(t)},_updateSelection:function(t,e,n){t._selectionState=n;var i=this._selectedSegmentState+=n-e;i>0&&this.setSelected(!0)},flatten:function(t){for(var e=new PathFlattener(this),n=0,i=e.length/Math.ceil(e.length/t),r=e.length+(this._closed?-i:i)/2,s=[];r>=n;)s.push(new Segment(e.evaluate(n,0))),n+=i;this.setSegments(s)},simplify:function(t){if(this._segments.length>2){var e=new PathFitter(this,t||2.5);this.setSegments(e.fit())}},isClockwise:function(){function t(t,r){void 0!==e&&(i+=(e-t)*(r+n)),e=t,n=r}if(void 0!==this._clockwise)return this._clockwise;for(var e,n,i=0,r=0,s=this._segments.length;s>r;r++){var o=this._segments[r],a=this._segments[s>r+1?r+1:0],u=o._point,h=o._handleOut,l=a._handleIn,c=a._point;t(u._x,u._y),t(u._x+h._x,u._y+h._y),t(c._x+l._x,c._y+l._y),t(c._x,c._y)}return i>0},setClockwise:function(t){this.isClockwise()!=(t=!!t)&&(this.reverse(),this._clockwise=t)},reverse:function(){this._segments.reverse();for(var t=0,e=this._segments.length;e>t;t++){var n=this._segments[t],i=n._handleIn;n._handleIn=n._handleOut,n._handleOut=i}void 0!==this._clockwise&&(this._clockwise=!this._clockwise)},join:function(t){if(t){var e=t._segments,n=this.getLastSegment(),i=t.getLastSegment();n._point.equals(i._point)&&t.reverse();var r=t.getFirstSegment();if(n._point.equals(r._point))n.setHandleOut(r._handleOut),this._add(e.slice(1));else{var s=this.getFirstSegment();s._point.equals(r._point)&&t.reverse(),i=t.getLastSegment(),s._point.equals(i._point)?(s.setHandleIn(i._handleIn),this._add(e.slice(0,e.length-1),0)):this._add(e.slice(0))}t.remove();var s=this.getFirstSegment();return n=this.getLastSegment(),n._point.equals(s._point)&&(s.setHandleIn(n._handleIn),n.remove(),this.setClosed(!0)),this._changed(Change.GEOMETRY),!0}return!1},getLength:function(){if(null==this._length){var t=this.getCurves();this._length=0;for(var e=0,n=t.length;n>e;e++)this._length+=t[e].getLength()}return this._length},_getOffset:function(t){var e=t&&t.getIndex();if(null!=e){for(var n=this.getCurves(),i=0,r=0;e>r;r++)i+=n[r].getLength();var s=n[e];return i+s.getLength(0,t.getParameter())}return null},getLocation:function(t){for(var e=this.getCurves(),n=0,i=e.length;i>n;n++){var r=e[n],s=r.getParameter(t);if(null!=s)return new CurveLocation(r,s)}return null},getLocationAt:function(t,e){var n=this.getCurves(),i=0;if(e){var r=~~t;return new CurveLocation(n[r],t-r)}for(var s=0,o=n.length;o>s;s++){var a=i,u=n[s];if(i+=u.getLength(),i>=t)return new CurveLocation(u,u.getParameterAt(t-a))}return t<=this.getLength()?new CurveLocation(n[n.length-1],1):null},getPointAt:function(t,e){var n=this.getLocationAt(t,e);return n&&n.getPoint()},getTangentAt:function(t,e){var n=this.getLocationAt(t,e);return n&&n.getTangent()},getNormalAt:function(t,e){var n=this.getLocationAt(t,e);return n&&n.getNormal()},getNearestLocation:function(t,e){for(var n=this.getCurves(),i=1/0,r=null,s=0,o=n.length;o>s;s++){var a=n[s].getNearestLocation(t,e);a._distance<i&&(i=a._distance,r=a)}return r},getNearestPoint:function(t,e){return this.getNearestLocation(t,e).getPoint()},contains:function(t,e){if(t=Point.read(arguments),!this._closed||!this.getRoughBounds(e)._containsPoint(t))return!1;for(var n=this.getCurves(),i=0,r=[],s=0,o=n.length;o>s;s++)i+=n[s].getCrossings(t,e,r);return 1==(1&i)},_hitTest:function(t,e,n){function i(i,r){i._transformCoordinates(n,u);for(var s=r||e.segments?0:2,a=!r&&e.handles?6:2;a>s;s+=2)if(t.getDistance(u[s],u[s+1])<o)return new HitResult(0==s?"segment":"handle-"+(2==s?"in":"out"),h,{segment:i})}var r,s,o=e.tolerance||0,a=(e.stroke?this.getStrokeWidth()/2:0)+o,u=[],h=this;if(!e.ends||e.segments||this._closed){if(e.segments||e.handles)for(var l=0,c=this._segments.length;c>l;l++)if(s=i(this._segments[l]))return s}else if(s=i(this.getFirstSegment(),!0)||i(this.getLastSegment(),!0))return s;return e.stroke&&a>0&&(r=this.getNearestLocation(t,n)),!(r&&r._distance<=a)&&e.fill&&this.getFillColor()&&this.contains(t,n)?new HitResult("fill",this):(!r&&e.stroke&&a>0&&(r=this.getNearestLocation(t,n)),r&&r._distance<=a?e.stroke?new HitResult("stroke",this,{location:r}):new HitResult("fill",this):void 0)}},new function(){function t(t,n){for(var i=0,r=n.length;r>i;i++){var s=n[i],o=s._point,a=s._selectionState,u=a&SelectionState.POINT;(u||a&SelectionState.HANDLE_IN)&&e(t,o,s._handleIn),(u||a&SelectionState.HANDLE_OUT)&&e(t,o,s._handleOut),t.save(),t.beginPath(),t.rect(o._x-2,o._y-2,4,4),t.fill(),u||(t.beginPath(),t.rect(o._x-1,o._y-1,2,2),t.fillStyle="#ffffff",t.fill()),t.restore()}}function e(t,e,n){if(!n.isZero()){var i=e._x+n._x,r=e._y+n._y;t.beginPath(),t.moveTo(e._x,e._y),t.lineTo(i,r),t.stroke(),t.beginPath(),t.arc(i,r,1.75,0,2*Math.PI,!0),t.fill()}}function n(t,e){function n(e){var n=o[e],a=n._point,u=a._x,h=a._y,l=n._handleIn;i?l.isZero()&&i.isZero()?t.lineTo(u,h):t.bezierCurveTo(r,s,l._x+u,l._y+h,u,h):t.moveTo(u,h),i=n._handleOut,r=i._x+u,s=i._y+h}for(var i,r,s,o=e._segments,a=o.length,u=0;a>u;u++)n(u);e._closed&&a>1&&n(0)}function i(t,e,n,i){for(var r,s=new PathFlattener(e),o=i,a=0;o<s.length;)r=o+n[a++%n.length],s.drawPart(t,o,r),o=r+n[a++%n.length]}return{draw:function(e,r){r.compound||e.beginPath();var s=this.getFillColor(),o=this.getStrokeColor(),a=this.getDashArray()||[],u=!!a.length;(r.compound||r.selection||this._clipMask||s||o&&!u)&&n(e,this),r.selection?(e.stroke(),t(e,this._segments)):this._clipMask?e.clip():r.compound||!s&&!o||(e.save(),this._setStyles(e),s&&o||(e.globalAlpha=this._opacity),s&&(e.fillStyle=s.getCanvasStyle(e),e.fill()),o&&(e.strokeStyle=o.getCanvasStyle(e),u&&(e.beginPath(),i(e,this,a,this.getDashOffset())),e.stroke()),e.restore())}}},new function(){function t(t){var e=t.length,n=[],i=[],r=2;n[0]=t[0]/r;for(var s=1;e>s;s++)i[s]=1/r,r=(e-1>s?4:2)-i[s],n[s]=(t[s]-n[s-1])/r;for(var s=1;e>s;s++)n[e-s-1]-=i[e-s]*n[e-s];return n}var e={getStrokeWidth:"lineWidth",getStrokeJoin:"lineJoin",getStrokeCap:"lineCap",getMiterLimit:"miterLimit"};return{_setStyles:function(t){for(var n in e){var i=this._style[n]();i&&(t[e[n]]=i)}},smooth:function(){var e,n=this._segments,i=n.length,r=i;if(!(2>=i)){this._closed?(e=Math.min(i,4),r+=2*Math.min(i,e)):e=0;for(var s=[],o=0;i>o;o++)s[o+e]=n[o]._point;if(this._closed)for(var o=0;e>o;o++)s[o]=n[o+i-e]._point,s[o+i+e]=n[o]._point;else r--;for(var a=[],o=1;r-1>o;o++)a[o]=4*s[o]._x+2*s[o+1]._x;a[0]=s[0]._x+2*s[1]._x,a[r-1]=3*s[r-1]._x;for(var u=t(a),o=1;r-1>o;o++)a[o]=4*s[o]._y+2*s[o+1]._y;a[0]=s[0]._y+2*s[1]._y,a[r-1]=3*s[r-1]._y;var h=t(a);if(this._closed){for(var o=0,l=i;e>o;o++,l++){var c=o/e,d=1-c;u[l]=u[o]*c+u[l]*d,h[l]=h[o]*c+h[l]*d;var f=o+e,g=l+e;u[g]=u[f]*d+u[g]*c,h[g]=h[f]*d+h[g]*c}r--}for(var p=null,o=e;r-e>=o;o++){var _=n[o-e];p&&_.setHandleIn(p.subtract(_._point)),r>o&&(_.setHandleOut(new Point(u[o],h[o]).subtract(_._point)),p=r-1>o?new Point(2*s[o+1]._x-u[o+1],2*s[o+1]._y-h[o+1]):new Point((s[r]._x+u[r-1])/2,(s[r]._y+h[r-1])/2))}if(this._closed&&p){var _=this._segments[0];_.setHandleIn(p.subtract(_._point))}}}}},new function(){function t(t){var e=t._segments;if(0==e.length)throw new Error("Use a moveTo() command first");return e[e.length-1]}return{moveTo:function(t){this._segments.length||this._add([new Segment(Point.read(arguments))])},moveBy:function(t){throw new Error("moveBy() is unsupported on Path items.")},lineTo:function(t){this._add([new Segment(Point.read(arguments))])},cubicCurveTo:function(e,n,i){e=Point.read(arguments,0,1),n=Point.read(arguments,1,1),i=Point.read(arguments,2,1);var r=t(this);r.setHandleOut(e.subtract(r._point)),this._add([new Segment(i,n.subtract(i))])},quadraticCurveTo:function(e,n){e=Point.read(arguments,0,1),n=Point.read(arguments,1,1);var i=t(this)._point;this.cubicCurveTo(e.add(i.subtract(e).multiply(1/3)),e.add(n.subtract(e).multiply(1/3)),n)},curveTo:function(e,n,i){e=Point.read(arguments,0,1),n=Point.read(arguments,1,1);var r=Base.pick(i,.5),s=1-r,o=t(this)._point,a=e.subtract(o.multiply(s*s)).subtract(n.multiply(r*r)).divide(2*r*s);if(a.isNaN())throw new Error("Cannot put a curve through points with parameter = "+r);this.quadraticCurveTo(a,n)},arcTo:function(e,n){var i,r=t(this),s=r._point;if(void 0===n&&(n=!0),"boolean"==typeof n){e=Point.read(arguments,0,1);var o=s.add(e).divide(2),i=o.add(o.subtract(s).rotate(n?-90:90))}else i=Point.read(arguments,0,1),e=Point.read(arguments,1,1);var a=new Line(s.add(i).divide(2),i.subtract(s).rotate(90)),u=new Line(i.add(e).divide(2),e.subtract(i).rotate(90)),h=a.intersect(u),l=new Line(s,e,!0),c=l.getSide(i);if(!h){if(!c)return this.lineTo(e);throw new Error("Cannot put an arc through the given points: "+[s,i,e])}var d=s.subtract(h),f=(d.getLength(),d.getDirectedAngle(e.subtract(h))),g=l.getSide(h);0==g?f=c*Math.abs(f):c==g&&(f-=360*(0>f?-1:1));for(var p=Math.abs(f),_=p>=360?4:Math.ceil(p/90),m=f/_,v=m*Math.PI/360,y=4/3*Math.sin(v)/(1+Math.cos(v)),w=[],x=0;_>=x;x++){var P=_>x?h.add(d):e,b=_>x?d.rotate(90).multiply(y):null;0==x?r.setHandleOut(b):w.push(new Segment(P,d.rotate(-90).multiply(y),b)),d=d.rotate(m)}this._add(w)},lineBy:function(e){e=Point.read(arguments);var n=t(this);this.lineTo(n._point.add(e))},curveBy:function(e,n,i){e=Point.read(e),n=Point.read(n);var r=t(this)._point;this.curveTo(r.add(e),r.add(n),i)},arcBy:function(e,n){e=Point.read(e),n=Point.read(n);var i=t(this)._point;this.arcBy(i.add(e),i.add(n))},closePath:function(){this.setClosed(!0)}}},new function(){function t(t,e,n){function i(t){function i(t,e){var i=0;if(null==t){var o=1-e;t=o*o*o*s+3*o*o*e*d+3*o*e*e*f+e*e*e*g,i=n?n[r]:0}var a=t-i,l=t+i;a<u[r]&&(u[r]=a),l>h[r]&&(h[r]=l)}t._transformCoordinates(e,o,!1);for(var r=0;2>r;r++){var s=a[r],d=a[r+4],f=o[r+2],g=o[r];i(g,null);var p=3*(d-f)-s+g,_=2*(s+f)-4*d,m=d-s;if(0!=p){var v=_*_-4*p*m;if(!(0>v)){var y=Math.sqrt(v),w=-.5/p,x=(_-y)*w,P=(_+y)*w;x>l&&c>x&&i(null,x),P>l&&c>P&&i(null,P)}}else{if(0==_)continue;var b=-m/_;b>l&&c>b&&i(null,b)}}var S=a;a=o,o=S}var r=t._segments,s=r[0];if(!s)return null;var o=new Array(6),a=new Array(6);e&&e.isIdentity()&&(e=null),s._transformCoordinates(e,a,!1);for(var u=a.slice(0,2),h=u.slice(0),l=Numerical.TOLERANCE,c=1-l,d=1,f=r.length;f>d;d++)i(r[d]);return t._closed&&i(s),Rectangle.create(u[0],u[1],h[0]-u[0],h[1]-u[1])}function e(t,e){if(!e)return[t,t];var n=e.createShiftless(),i=n.transform(new Point(t,0)),r=n.transform(new Point(0,t)),s=i.getAngleInRadians(),o=i.getLength(),a=r.getLength(),u=-Math.atan(a*Math.tan(s)),h=+Math.atan(a/Math.tan(s)),l=o*Math.cos(u)*Math.cos(s)-a*Math.sin(u)*Math.sin(s),c=a*Math.sin(h)*Math.cos(s)+o*Math.cos(h)*Math.sin(s);return[Math.abs(l),Math.abs(c)]}return{getBounds:function(){var e=void 0===arguments[0];if(e&&this._bounds)return this._bounds;var n=this._createBounds(t(this,arguments[0]));return e&&(this._bounds=n),n},getStrokeBounds:function(){function n(t){_=_.include(a?a.transform(t):t)}function i(t,e){var i=t.getPoint(e),r=t.getNormal(e).normalize(h);n(i.add(r)),n(i.subtract(r))}function r(t,e){if("round"===e||!t._handleIn.isZero()&&!t._handleOut.isZero())_=_.unite(m.setCenter(a?a.transform(t._point):t._point));else if("bevel"==e){var s=t.getCurve();i(s,0),i(s.getPrevious(),1)}else if("miter"==e){var o=t.getCurve(),u=o.getPrevious(),l=o.getPoint(0),c=u.getNormal(1).normalize(h),d=o.getNormal(0).normalize(h),g=new Line(l.subtract(c),new Point(-c.y,c.x)),p=new Line(l.subtract(d),new Point(-d.y,d.x)),v=g.intersect(p);!v||l.getDistance(v)>f?r(t,"bevel"):n(v)}}function s(t,e,i){switch(e){case"round":return r(t,e);case"butt":case"square":var s=t.getCurve(),o=s.getPoint(i),a=s.getNormal(i).normalize(h);"square"===e&&(o=o.add(a.y,-a.x)),n(o.add(a)),n(o.subtract(a))}}if(!this._style._strokeColor||!this._style._strokeWidth)return this.getBounds.apply(this,arguments);var o=void 0===arguments[0];if(o&&this._strokeBounds)return this._strokeBounds;for(var a=arguments[0],u=this.getStrokeWidth(),h=u/2,l=e(h,a),c=this.getStrokeJoin(),d=this.getStrokeCap(),f=this.getMiterLimit()*u/2,g=this._segments,p=g.length,_=t(this,a,e(h)),m=new Rectangle(new Size(l).multiply(2)),v=1,y=p-(this._closed?0:1);y>v;v++)r(g[v],c);return this._closed?r(g[0],c):(s(g[0],d,0),s(g[p-1],d,1)),o&&(this._strokeBounds=_),_},getHandleBounds:function(){var t=arguments[0],e=void 0===t;if(e&&this._handleBounds)return this._handleBounds;for(var n=new Array(6),i=arguments[1]/2||0,r=arguments[2]/2||0,s=(!this._closed,1/0),o=-s,a=s,u=o,h=0,l=this._segments.length;l>h;h++){var c=this._segments[h];c._transformCoordinates(t,n,!1);for(var d=0;6>d;d+=2){var f=0==d?r:i,g=n[d],p=n[d+1],_=g-f,m=g+f,v=p-f,y=p+f;s>_&&(s=_),m>o&&(o=m),a>v&&(a=v),y>u&&(u=y)}}var w=Rectangle.create(s,a,o-s,u-a);return e&&(this._handleBounds=w),w},getRoughBounds:function(){var t=void 0===arguments[0];if(t&&this._roughBounds)return this._roughBounds;var e=this.getHandleBounds(arguments[0],this.strokeWidth,"miter"==this.getStrokeJoin()?this.strokeWidth*this.getMiterLimit():this.strokeWidth);return t&&(this._roughBounds=e),e}}});Path.inject({statics:new function(){var t=2/3*(Math.sqrt(2)-1),e=[new Segment([0,.5],[0,t],[0,-t]),new Segment([.5,0],[-t,0],[t,0]),new Segment([1,.5],[0,-t],[0,t]),new Segment([.5,1],[t,0],[-t,0])];return{Line:function(){var t=Math.floor(arguments.length/2);return new Path(Segment.read(arguments,0,t),Segment.read(arguments,t,t))},Rectangle:function(t){t=Rectangle.read(arguments);var e=t.x,n=t.y;return right=e+t.width,bottom=n+t.height,path=new Path,path._add([new Segment(Point.create(e,bottom)),new Segment(Point.create(e,n)),new Segment(Point.create(right,n)),new Segment(Point.create(right,bottom))]),path._closed=!0,path},RoundRectangle:function(e,n){2==arguments.length?(e=Rectangle.read(arguments,0,1),n=Size.read(arguments,1,1)):6==arguments.length&&(e=Rectangle.read(arguments,0,4),n=Size.read(arguments,4,2)),n=Size.min(n,e.getSize(!0).divide(2));var i=new Path,r=n.multiply(2*t),s=e.getBottomLeft(!0),o=e.getTopLeft(!0),a=e.getTopRight(!0),u=e.getBottomRight(!0);return i._add([new Segment(s.add(n.width,0),null,[-r.width,0]),new Segment(s.subtract(0,n.height),[0,r.height],null),new Segment(o.add(0,n.height),null,[0,-r.height]),new Segment(o.add(n.width,0),[-r.width,0],null),new Segment(a.subtract(n.width,0),null,[r.width,0]),new Segment(a.add(0,n.height),[0,-r.height],null),new Segment(u.subtract(0,n.height),null,[0,r.height]),new Segment(u.subtract(n.width,0),[r.width,0],null)]),i._closed=!0,i},Oval:function(t){t=Rectangle.read(arguments);for(var n=new Path,i=t.getPoint(!0),r=t.getSize(!0),s=new Array(4),o=0;4>o;o++){var a=e[o];s[o]=new Segment(a._point.multiply(r).add(i),a._handleIn.multiply(r),a._handleOut.multiply(r))}return n._add(s),n._closed=!0,n},Circle:function(t,e){return 3==arguments.length?(t=Point.read(arguments,0,2),e=arguments[2]):t=Point.read(arguments,0,1),Path.Oval(new Rectangle(t.subtract(e),Size.create(2*e,2*e)))},Arc:function(t,e,n){var i=new Path;return i.moveTo(t),i.arcTo(e,n),i},RegularPolygon:function(t,e,n){t=Point.read(arguments,0,1);for(var i=new Path,r=360/e,s=!(e%3),o=new Point(0,s?-n:n),a=s?-1:.5,u=new Array(e),h=0;e>h;h++)u[h]=new Segment(t.add(o.rotate((h+a)*r)));return i._add(u),i._closed=!0,i},Star:function(t,e,n,i){t=Point.read(arguments,0,1),e*=2;for(var r=new Path,s=360/e,o=new Point(0,-1),a=new Array(e),u=0;e>u;u++)a[u]=new Segment(t.add(o.rotate(s*u).multiply(u%2?i:n)));return r._add(a),r._closed=!0,r}}}});var CompoundPath=this.CompoundPath=PathItem.extend({initialize:function(t){this.base(),this._children=[],this._namedChildren={};var e=t&&Array.isArray(t)&&"object"==typeof t[0]?t:arguments;this.addChildren(e)},insertChild:function(t,e){this.base(t,e),void 0===e._clockwise&&e.setClockwise(0==e._index)},simplify:function(){if(1==this._children.length){var t=this._children[0];return t.insertAbove(this),this.remove(),t}return this},smooth:function(){for(var t=0,e=this._children.length;e>t;t++)this._children[t].smooth()},draw:function(t,e){var n=this._children.length;if(0!=n){var i=this._children[0];t.beginPath(),e.compound=!0;for(var r=0;n>r;r++)Item.draw(this._children[r],t,e);i._setStyles(t);var s=i.getFillColor(),o=i.getStrokeColor();s&&(t.fillStyle=s.getCanvasStyle(t),t.fill()),o&&(t.strokeStyle=o.getCanvasStyle(t),t.stroke()),e.compound=!1}}},new function(){function t(t){if(!t._children.length)throw new Error("Use a moveTo() command first");return t._children[t._children.length-1]}var e={moveTo:function(t){var e=new Path;this.addChild(e),e.moveTo.apply(e,arguments)},moveBy:function(e){this.moveTo(t(this).getLastSegment()._point.add(Point.read(arguments)))},closePath:function(){t(this).setClosed(!0)}};return Base.each(["lineTo","cubicCurveTo","quadraticCurveTo","curveTo","arcTo","lineBy","curveBy","arcBy"],function(n){e[n]=function(){var e=t(this);e[n].apply(e,arguments)}}),e}),PathFlattener=Base.extend({initialize:function(t){function e(t,e){var n=Curve.getValues(t,e);s.curves.push(n),s._computeParts(n,t._index,0,1)}this.curves=[],this.parts=[],this.length=0,this.index=0;for(var n,i=t._segments,r=i[0],s=this,o=1,a=i.length;a>o;o++)n=i[o],e(r,n),r=n;t._closed&&e(n,i[0])},_computeParts:function(t,e,n,i){if(i-n>1/32&&!Curve.isFlatEnough(t)){var r=Curve.subdivide(t),s=(n+i)/2;this._computeParts(r[0],e,n,s),this._computeParts(r[1],e,s,i)}else{var o=t[6]-t[0],a=t[7]-t[1],u=Math.sqrt(o*o+a*a);u>Numerical.TOLERANCE&&(this.length+=u,this.parts.push({offset:this.length,value:i,index:e}))}},getParameterAt:function(t){for(var e,n=this.index;e=n,!(0==n||this.parts[--n].offset<t););for(var i=this.parts.length;i>e;e++){var r=this.parts[e];if(r.offset>=t){this.index=e;var s=this.parts[e-1],o=s&&s.index==r.index?s.value:0,a=s?s.offset:0;return{value:o+(r.value-o)*(t-a)/(r.offset-a),index:r.index}}}var r=this.parts[this.parts.length-1];return{value:1,index:r.index}},evaluate:function(t,e){var n=this.getParameterAt(t);return Curve.evaluate(this.curves[n.index],n.value,e)},drawPart:function(t,e,n){e=this.getParameterAt(e),n=this.getParameterAt(n);for(var i=e.index;i<=n.index;i++){var r=Curve.getPart(this.curves[i],i==e.index?e.value:0,i==n.index?n.value:1);i==e.index&&t.moveTo(r[0],r[1]),t.bezierCurveTo.apply(t,r.slice(2))}}}),PathFitter=Base.extend({initialize:function(t,e){this.points=[];for(var n,i=t._segments,r=0,s=i.length;s>r;r++){var o=i[r].point.clone();n&&n.equals(o)||(this.points.push(o),n=o)}this.error=e},fit:function(){return this.segments=[new Segment(this.points[0])],this.fitCubic(0,this.points.length-1,this.points[1].subtract(this.points[0]).normalize(),this.points[this.points.length-2].subtract(this.points[this.points.length-1]).normalize()),this.segments},fitCubic:function(t,e,n,i){if(e-t==1){var r=this.points[t],s=this.points[e],o=r.getDistance(s)/3;return void this.addCurve([r,r.add(n.normalize(o)),s.add(i.normalize(o)),s])}for(var a,u=this.chordLengthParameterize(t,e),h=Math.max(this.error,this.error*this.error),l=0;4>=l;l++){var c=this.generateBezier(t,e,u,n,i),d=this.findMaxError(t,e,c,u);if(d.error<this.error)return void this.addCurve(c);if(a=d.index,d.error>=h)break;this.reparameterize(t,e,u,c),h=d.error}var f=this.points[a-1].subtract(this.points[a]),g=this.points[a].subtract(this.points[a+1]),p=f.add(g).divide(2).normalize();this.fitCubic(t,a,n,p),this.fitCubic(a,e,p.negate(),i)},addCurve:function(t){var e=this.segments[this.segments.length-1];e.setHandleOut(t[1].subtract(t[0])),this.segments.push(new Segment(t[3],t[2].subtract(t[3])))},generateBezier:function(t,e,n,i,r){for(var s=Numerical.EPSILON,o=this.points[t],a=this.points[e],u=[[0,0],[0,0]],h=[0,0],l=0,c=e-t+1;c>l;l++){var d=n[l],f=1-d,g=3*d*f,p=f*f*f,_=g*f,m=g*d,v=d*d*d,y=i.normalize(_),w=r.normalize(m),x=this.points[t+l].subtract(o.multiply(p+_)).subtract(a.multiply(m+v));u[0][0]+=y.dot(y),u[0][1]+=y.dot(w),u[1][0]=u[0][1],u[1][1]+=w.dot(w),h[0]+=y.dot(x),h[1]+=w.dot(x)}var P,b,S=u[0][0]*u[1][1]-u[1][0]*u[0][1];if(Math.abs(S)>s){var C=u[0][0]*h[1]-u[1][0]*h[0],E=h[0]*u[1][1]-h[1]*u[0][1];P=E/S,b=C/S}else{var M=u[0][0]+u[0][1],T=u[1][0]+u[1][1];P=b=Math.abs(M)>s?h[0]/M:Math.abs(M)>s?h[1]/T:0}var k=a.getDistance(o);return s*=k,(s>P||s>b)&&(P=b=k/3),[o,o.add(i.normalize(P)),a.add(r.normalize(b)),a]},reparameterize:function(t,e,n,i){for(var r=t;e>=r;r++)n[r-t]=this.findRoot(i,this.points[r],n[r-t])},findRoot:function(t,e,n){for(var i=[],r=[],s=0;2>=s;s++)i[s]=t[s+1].subtract(t[s]).multiply(3);for(var s=0;1>=s;s++)r[s]=i[s+1].subtract(i[s]).multiply(2);var o=this.evaluate(3,t,n),a=this.evaluate(2,i,n),u=this.evaluate(1,r,n),h=o.subtract(e),l=a.dot(a)+h.dot(u);return Math.abs(l)<Numerical.TOLERANCE?n:n-h.dot(a)/l},evaluate:function(t,e,n){for(var i=e.slice(),r=1;t>=r;r++)for(var s=0;t-r>=s;s++)i[s]=i[s].multiply(1-n).add(i[s+1].multiply(n));return i[0]},chordLengthParameterize:function(t,e){for(var n=[0],i=t+1;e>=i;i++)n[i-t]=n[i-t-1]+this.points[i].getDistance(this.points[i-1]);for(var i=1,r=e-t;r>=i;i++)n[i]/=n[r];return n},findMaxError:function(t,e,n,i){for(var r=Math.floor((e-t+1)/2),s=0,o=t+1;e>o;o++){var a=this.evaluate(3,n,i[o-t]),u=a.subtract(this.points[o]),h=u.x*u.x+u.y*u.y;h>=s&&(s=h,r=o)}return{error:s,index:r}}}),TextItem=this.TextItem=Item.extend({initialize:function(){this.base(),this._content="",this._characterStyle=CharacterStyle.create(this),this.setCharacterStyle(this._project.getCurrentStyle()),this._paragraphStyle=ParagraphStyle.create(this),this.setParagraphStyle()},_clone:function(t){return t._content=this._content,t.setCharacterStyle(this._characterStyle),t.setParagraphStyle(this._paragraphStyle),this.base(t)},getContent:function(){return this._content},setContent:function(t){this._changed(Change.CONTENT),this._content=""+t},getCharacterStyle:function(){return this._characterStyle},setCharacterStyle:function(t){this._characterStyle.initialize(t)},getParagraphStyle:function(){return this._paragraphStyle},setParagraphStyle:function(t){this._paragraphStyle.initialize(t)}}),PointText=this.PointText=TextItem.extend({initialize:function(t){this.base(),this._point=Point.read(arguments).clone(),this._matrix=(new Matrix).translate(this._point)},clone:function(){var t=this._clone(new PointText(this._point));return t._matrix.initialize(this._matrix),t},getPoint:function(){return LinkedPoint.create(this,"setPoint",this._point.x,this._point.y)},setPoint:function(t){this.translate(Point.read(arguments).subtract(this._point))},getPosition:function(){return this.getPoint()},setPosition:function(t){this.setPoint.apply(this,arguments)},_transform:function(t,e){this._matrix.preConcatenate(t),t._transformPoint(this._point,this._point)},draw:function(t){if(this._content){t.save(),t.font=this.getFontSize()+"pt "+this.getFont(),t.textAlign=this.getJustification(),this._matrix.applyToContext(t);var e=this.getFillColor(),n=this.getStrokeColor();e&&n||(t.globalAlpha=this._opacity),e&&(t.fillStyle=e.getCanvasStyle(t),t.fillText(this._content,0,0)),n&&(t.strokeStyle=n.getCanvasStyle(t),t.strokeText(this._content,0,0)),t.restore()}}}),Style=Item.extend({initialize:function(t){var e=t instanceof Style;return Base.each(this._defaults,function(n,i){n=t&&t[i]||n,this[i]=n&&e&&n.clone?n.clone():n},this)},statics:{create:function(t){var e=new this(this.dont);return e._item=t,e},extend:function(t){var e=t._style,n=t._flags||{};return t._owner.inject(Base.each(t._defaults,function(i,r){var s=!!r.match(/Color$/),o=Base.capitalize(r),a="set"+o,u="get"+o;t[a]=function(t){var i=this._item&&this._item._children;if(t=s?Color.read(arguments):t,i)for(var o=0,u=i.length;u>o;o++)i[o][e][a](t);else{var h=this["_"+r];h==t||h&&h.equals&&h.equals(t)||(this["_"+r]=t,s&&(h&&h._removeOwner(this._item),t&&t._addOwner(this._item)),this._item&&this._item._changed(n[r]||Change.STYLE))}return this},t[u]=function(){var t,n=this._item&&this._item._children;if(!n)return this["_"+r];for(var i=0,s=n.length;s>i;i++){var o=n[i][e][u]();if(t){if(t!=o&&!(t&&t.equals&&t.equals(o)))return}else t=o}return t},this[a]=function(t){return this[e][a](t),this},this[u]=function(){return this[e][u]()}},{})),this.base(t)}}}),PathStyle=this.PathStyle=Style.extend({_defaults:{fillColor:void 0,strokeColor:void 0,strokeWidth:1,strokeCap:"butt",strokeJoin:"miter",miterLimit:10,dashOffset:0,dashArray:[]},_flags:{strokeWidth:Change.STROKE,strokeCap:Change.STROKE,strokeJoin:Change.STROKE,miterLimit:Change.STROKE},_owner:Item,_style:"_style"}),ParagraphStyle=this.ParagraphStyle=Style.extend({_defaults:{justification:"left"},_owner:TextItem,_style:"_paragraphStyle"}),CharacterStyle=this.CharacterStyle=PathStyle.extend({_defaults:Base.merge(PathStyle.prototype._defaults,{fillColor:"black",fontSize:10,font:"sans-serif"}),_owner:TextItem,_style:"_characterStyle"}),Color=this.Color=Base.extend(new function(){function t(t){var e=r[t];if(e)return e.clone();if(!n){var i=CanvasProvider.getCanvas(Size.create(1,1));n=i.getContext("2d"),n.globalCompositeOperation="copy"}n.fillStyle="rgba(0,0,0,0)",n.fillStyle=t,n.fillRect(0,0,1,1);var s=n.getImageData(0,0,1,1).data,o=[s[0]/255,s[1]/255,s[2]/255];return(r[t]=RgbColor.read(o)).clone()}function e(t){var e=t.match(/^#?(\w{1,2})(\w{1,2})(\w{1,2})$/);if(e.length>=4){for(var n=new Array(3),i=0;3>i;i++){var r=e[i+1];n[i]=parseInt(1==r.length?r+r:r,16)/255;   }return RgbColor.read(n)}}var n,i={gray:["gray"],rgb:["red","green","blue"],hsb:["hue","saturation","brightness"],hsl:["hue","saturation","lightness"]},r={},s=[[0,3,1],[2,0,1],[1,0,3],[1,2,0],[3,1,0],[0,1,2]],o={"rgb-hsb":function(t){var e=t._red,n=t._green,i=t._blue,r=Math.max(e,n,i),s=Math.min(e,n,i),o=r-s,a=0==o?0:60*(r==e?(n-i)/o+(i>n?6:0):r==n?(i-e)/o+2:(e-n)/o+4),u=0==r?0:o/r,h=r;return new HsbColor(a,u,h,t._alpha)},"hsb-rgb":function(t){var e=t._hue/60%6,n=t._saturation,i=t._brightness,r=Math.floor(e),o=e-r,r=s[r],a=[i,i*(1-n),i*(1-n*o),i*(1-n*(1-o))];return new RgbColor(a[r[0]],a[r[1]],a[r[2]],t._alpha)},"rgb-hsl":function(t){var e=t._red,n=t._green,i=t._blue,r=Math.max(e,n,i),s=Math.min(e,n,i),o=r-s,a=0==o,u=a?0:60*(r==e?(n-i)/o+(i>n?6:0):r==n?(i-e)/o+2:(e-n)/o+4),h=(r+s)/2,l=a?0:.5>h?o/(r+s):o/(2-r-s);return new HslColor(u,l,h,t._alpha)},"hsl-rgb":function(t){var e,n,i,r=t._saturation,s=t._hue/360,o=t._lightness;if(0==r)return new RgbColor(o,o,o,t._alpha);for(var a=[s+1/3,s,s-1/3],n=.5>o?o*(1+r):o+r-o*r,e=2*o-n,i=[],u=0;3>u;u++){var h=a[u];0>h&&(h+=1),h>1&&(h-=1),i[u]=1>6*h?e+6*(n-e)*h:1>2*h?n:2>3*h?e+(n-e)*(2/3-h)*6:e}return new RgbColor(i[0],i[1],i[2],t._alpha)},"rgb-gray":function(t){return new GrayColor(1-(.2989*t._red+.587*t._green+.114*t._blue),t._alpha)},"gray-rgb":function(t){var e=1-t._gray;return new RgbColor(e,e,e,t._alpha)},"gray-hsb":function(t){return new HsbColor(0,0,1-t._gray,t._alpha)},"gray-hsl":function(t){return new HslColor(0,0,1-t._gray,t._alpha)}},a={_readNull:!0,initialize:function(n){var i=Array.isArray(n),r=this._colorType;if("object"==typeof n&&!i)return r?Color.read(arguments).convert(r):void 0!==n.red?new RgbColor(n.red,n.green,n.blue,n.alpha):void 0!==n.gray?new GrayColor(n.gray,n.alpha):void 0!==n.lightness?new HslColor(n.hue,n.saturation,n.lightness,n.alpha):void 0!==n.hue?new HsbColor(n.hue,n.saturation,n.brightness,n.alpha):new RgbColor;if("string"==typeof n){var s=n.match(/^#[0-9a-f]{3,6}$/i)?e(n):t(n);return r?s.convert(r):s}var o=i?n:Array.prototype.slice.call(arguments);return r?void Base.each(this._components,function(t,e){var n=o[e];this["_"+t]=void 0!==n?n:null},this):o.length>=3?new RgbColor(o):new GrayColor(o)},clone:function(){for(var t=this.constructor,e=new t(t.dont),n=this._components,i=0,r=n.length;r>i;i++){var s="_"+n[i];e[s]=this[s]}return e},convert:function(t){var e;return this._colorType==t?this.clone():(e=o[this._colorType+"-"+t])?e(this):o["rgb-"+t](o[this._colorType+"-rgb"](this))},statics:{extend:function(t){if(t.beans=!0,t._colorType){var e=i[t._colorType];t._components=e.concat(["alpha"]),Base.each(e,function(t){var e="hue"===t,n=Base.capitalize(t),t="_"+t;this["get"+n]=function(){return this[t]},this["set"+n]=function(n){return this[t]=e?(n%360+360)%360:Math.min(Math.max(n,0),1),this._changed(),this}},t)}return this.base(t)}}};return Base.each(i,function(t,e){Base.each(t,function(t){var n=Base.capitalize(t);a["get"+n]=function(){return this.convert(e)[t]},a["set"+n]=function(n){var i=this.convert(e);i[t]=n,i=i.convert(this._colorType);for(var r=0,s=this._components.length;s>r;r++){var o=this._components[r];this[o]=i[o]}}})}),a},{_changed:function(){this._cssString=null;for(var t=0,e=this._owners&&this._owners.length;e>t;t++)this._owners[t]._changed(Change.STYLE)},_addOwner:function(t){this._owners||(this._owners=[]),this._owners.push(t)},_removeOwner:function(t){var e=this._owners?this._owners.indexOf(t):-1;-1!=e&&(this._owners.splice(e,1),0==this._owners.length&&delete this._owners)},getType:function(){return this._colorType},getComponents:function(){for(var t=this._components.length,e=new Array(t),n=0;t>n;n++)e[n]=this["_"+this._components[n]];return e},getAlpha:function(){return null!=this._alpha?this._alpha:1},setAlpha:function(t){return this._alpha=null==t?null:Math.min(Math.max(t,0),1),this._changed(),this},hasAlpha:function(){return null!=this._alpha},equals:function(t){if(t&&t._colorType===this._colorType){for(var e=0,n=this._components.length;n>e;e++){var i="_"+this._components[e];if(this[i]!==t[i])return!1}return!0}return!1},toString:function(){for(var t=[],e=Base.formatNumber,n=0,i=this._components.length;i>n;n++){var r=this._components[n],s=this["_"+r];"alpha"===r&&null==s&&(s=1),t.push(r+": "+e(s))}return"{ "+t.join(", ")+" }"},toCssString:function(){if(!this._cssString){var t=this.convert("rgb"),e=t.getAlpha(),n=[Math.round(255*t._red),Math.round(255*t._green),Math.round(255*t._blue),null!=e?e:1];this._cssString="rgba("+n.join(", ")+")"}return this._cssString},getCanvasStyle:function(){return this.toCssString()}}),GrayColor=this.GrayColor=Color.extend({_colorType:"gray"}),RgbColor=this.RgbColor=this.RGBColor=Color.extend({_colorType:"rgb"}),HsbColor=this.HsbColor=this.HSBColor=Color.extend({_colorType:"hsb"}),HslColor=this.HslColor=this.HSLColor=Color.extend({_colorType:"hsl"}),GradientColor=this.GradientColor=Color.extend({initialize:function(t,e,n,i){this.gradient=t||new Gradient,this.setOrigin(e),this.setDestination(n),i&&this.setHilite(i)},clone:function(){return new GradientColor(this.gradient,this._origin,this._destination,this._hilite)},getOrigin:function(){return this._origin},setOrigin:function(t){return t=Point.read(arguments).clone(),this._origin=t,this._destination&&(this._radius=this._destination.getDistance(this._origin)),this._changed(),this},getDestination:function(){return this._destination},setDestination:function(t){return t=Point.read(arguments).clone(),this._destination=t,this._radius=this._destination.getDistance(this._origin),this._changed(),this},getHilite:function(){return this._hilite},setHilite:function(t){t=Point.read(arguments).clone();var e=t.subtract(this._origin);return e.getLength()>this._radius?this._hilite=this._origin.add(e.normalize(this._radius-.1)):this._hilite=t,this._changed(),this},getCanvasStyle:function(t){var e;if("linear"===this.gradient.type)e=t.createLinearGradient(this._origin.x,this._origin.y,this._destination.x,this._destination.y);else{var n=this._hilite||this._origin;e=t.createRadialGradient(n.x,n.y,0,this._origin.x,this._origin.y,this._radius)}for(var i=0,r=this.gradient._stops.length;r>i;i++){var s=this.gradient._stops[i];e.addColorStop(s._rampPoint,s._color.toCssString())}return e},equals:function(t){return t==this||t&&t._colorType===this._colorType&&this.gradient.equals(t.gradient)&&this._origin.equals(t._origin)&&this._destination.equals(t._destination)},transform:function(t){t._transformPoint(this._origin,this._origin,!0),t._transformPoint(this._destination,this._destination,!0),this._hilite&&t._transformPoint(this._hilite,this._hilite,!0),this._radius=this._destination.getDistance(this._origin)}}),Gradient=this.Gradient=Base.extend({initialize:function(t,e){this.setStops(t||["white","black"]),this.type=e||"linear"},clone:function(){for(var t=[],e=0,n=this._stops.length;n>e;e++)t[e]=this._stops[e].clone();return new Gradient(t,this.type)},getStops:function(){return this._stops},setStops:function(t){if(t.length<2)throw new Error("Gradient stop list needs to contain at least two stops.");this._stops=GradientStop.readAll(t);for(var e=0,n=this._stops.length;n>e;e++){var i=this._stops[e];i._defaultRamp&&i.setRampPoint(e/(n-1))}},equals:function(t){if(t.type!=this.type)return!1;if(this._stops.length==t._stops.length){for(var e=0,n=this._stops.length;n>e;e++)if(!this._stops[e].equals(t._stops[e]))return!1;return!0}return!1}}),GradientStop=this.GradientStop=Base.extend({initialize:function(t,e){void 0===e&&Array.isArray(t)?(this.setColor(t[0]),this.setRampPoint(t[1])):t.color?(this.setColor(t.color),this.setRampPoint(t.rampPoint)):(this.setColor(t),this.setRampPoint(e))},clone:function(){return new GradientStop(this._color.clone(),this._rampPoint)},getRampPoint:function(){return this._rampPoint},setRampPoint:function(t){this._defaultRamp=null==t,this._rampPoint=t||0},getColor:function(){return this._color},setColor:function(t){this._color=Color.read(arguments)},equals:function(t){return t==this||t instanceof GradientStop&&this._color.equals(t._color)&&this._rampPoint==t._rampPoint}}),DomElement={getBounds:function(t,e){var n=t.getBoundingClientRect(),i=t.ownerDocument,r=i.body,s=i.documentElement,o=n.left-(s.clientLeft||r.clientLeft||0),a=n.top-(s.clientTop||r.clientTop||0);if(!e){var u=DomElement.getViewport(i);o+=u.pageXOffset||s.scrollLeft||r.scrollLeft,a+=u.pageYOffset||s.scrollTop||r.scrollTop}return new Rectangle(o,a,n.width,n.height)},getOffset:function(t,e){return this.getBounds(t,e).getPoint()},getSize:function(t){return this.getBounds(t,!0).getSize()},isInvisible:function(t){return this.getSize(t).equals([0,0])},isVisible:function(t){return!this.isInvisible(t)&&this.getViewportBounds(t).intersects(this.getBounds(t,!0))},getViewport:function(t){return t.defaultView||t.parentWindow},getViewportBounds:function(t){var e=t.ownerDocument,n=this.getViewport(e),i=e.getElementsByTagName("CSS1Compat"===e.compatMode?"html":"body")[0];return Rectangle.create(0,0,n.innerWidth||i.clientWidth,n.innerHeight||i.clientHeight)},getComputedStyle:function(t,e){if(t.currentStyle)return t.currentStyle[Base.camelize(e)];var n=this.getViewport(t.ownerDocument).getComputedStyle(t,null);return n?n.getPropertyValue(Base.hyphenate(e)):null}},DomEvent={add:function(t,e){for(var n in e){var i=e[n];t.addEventListener?t.addEventListener(n,i,!1):t.attachEvent&&t.attachEvent("on"+n,i.bound=function(){i.call(t,window.event)})}},remove:function(t,e){for(var n in e){var i=e[n];t.removeEventListener?t.removeEventListener(n,i,!1):t.detachEvent&&t.detachEvent("on"+n,i.bound)}},getPoint:function(t){var e=t.targetTouches?t.targetTouches.length?t.targetTouches[0]:t.changedTouches[0]:t;return Point.create(e.pageX||e.clientX+document.documentElement.scrollLeft,e.pageY||e.clientY+document.documentElement.scrollTop)},getTarget:function(t){return t.target||t.srcElement},getOffset:function(t,e){return DomEvent.getPoint(t).subtract(DomElement.getOffset(e||DomEvent.getTarget(t)))},preventDefault:function(t){t.preventDefault?t.preventDefault():t.returnValue=!1},stopPropagation:function(t){t.stopPropagation?t.stopPropagation():t.cancelBubble=!0},stop:function(t){DomEvent.stopPropagation(t),DomEvent.preventDefault(t)}};DomEvent.requestAnimationFrame=new function(){var t="equestAnimationFrame",e=window["r"+t]||window["webkitR"+t]||window["mozR"+t]||window["oR"+t]||window["msR"+t];e&&e(function(t){void 0==t&&(e=null)});var n,i=[],r=!0;return DomEvent.add(window,{focus:function(){r=!0},blur:function(){r=!1}}),function(t,s){return e?e(t,s):(i.push([t,s]),void(n||(n=window.setInterval(function(){for(var t=i.length-1;t>=0;t--){var e=i[t],n=e[0],s=e[1];(!s||("true"==PaperScript.getAttribute(s,"keepalive")||r)&&DomElement.isVisible(s))&&(i.splice(t,1),n(Date.now()))}},1e3/60))))}};var View=this.View=PaperScopeItem.extend({_list:"views",_reference:"view",initialize:function(t){this.base();var e;if("string"==typeof t&&(t=document.getElementById(t)),t instanceof HTMLCanvasElement){if(this._canvas=t,PaperScript.hasAttribute(t,"resize")){var n=DomElement.getOffset(t,!0),i=this;e=DomElement.getViewportBounds(t).getSize().subtract(n),t.width=e.width,t.height=e.height,DomEvent.add(window,{resize:function(e){DomElement.isInvisible(t)||(n=DomElement.getOffset(t,!0)),i.setViewSize(DomElement.getViewportBounds(t).getSize().subtract(n))}})}else e=DomElement.isInvisible(t)?Size.create(parseInt(t.getAttribute("width")),parseInt(t.getAttribute("height"))):DomElement.getSize(t);if(PaperScript.hasAttribute(t,"stats")){this._stats=new Stats;var r=this._stats.domElement,s=r.style,n=DomElement.getOffset(t);s.position="absolute",s.left=n.x+"px",s.top=n.y+"px",document.body.appendChild(r)}}else e=Size.read(arguments,1),e.isZero()&&(e=new Size(1024,768)),this._canvas=CanvasProvider.getCanvas(e);this._id=this._canvas.getAttribute("id"),null==this._id&&this._canvas.setAttribute("id",this._id="canvas-"+View._id++),View._views[this._id]=this,this._viewSize=LinkedSize.create(this,"setViewSize",e.width,e.height),this._context=this._canvas.getContext("2d"),this._matrix=new Matrix,this._zoom=1,this._events=this._createEvents(),DomEvent.add(this._canvas,this._events),View._focused||(View._focused=this),this._scope._redrawNotified=!1},remove:function(){return this.base()?(View._focused==this&&(View._focused=null),delete View._views[this._id],DomEvent.remove(this._canvas,this._events),this._canvas=this._events=this._onFrame=null,!0):!1},_redraw:function(){this._redrawNeeded=!0,this._onFrameCallback?this._onFrameCallback(0,!0):this.draw()},_transform:function(t,e){this._matrix.preConcatenate(t),this._bounds=null,this._inverse=null,this._redraw()},getCanvas:function(){return this._canvas},getViewSize:function(){return this._viewSize},setViewSize:function(t){t=Size.read(arguments);var e=t.subtract(this._viewSize);e.isZero()||(this._canvas.width=t.width,this._canvas.height=t.height,this._viewSize.set(t.width,t.height,!0),this._bounds=null,this._redrawNeeded=!0,this.onResize&&this.onResize({size:t,delta:e}),this._redraw())},getBounds:function(){return this._bounds||(this._bounds=this._getInverse()._transformBounds(new Rectangle(new Point,this._viewSize))),this._bounds},getSize:function(){return this.getBounds().getSize()},getCenter:function(){return this.getBounds().getCenter()},setCenter:function(t){this.scrollBy(Point.read(arguments).subtract(this.getCenter()))},getZoom:function(){return this._zoom},setZoom:function(t){this._transform((new Matrix).scale(t/this._zoom,this.getCenter())),this._zoom=t},isVisible:function(){return DomElement.isVisible(this._canvas)},scrollBy:function(t){this._transform((new Matrix).translate(Point.read(arguments).negate()))},draw:function(t){if(t&&!this._redrawNeeded)return!1;this._stats&&this._stats.update();var e=this._context,n=this._viewSize;return e.clearRect(0,0,n._width+1,n._height+1),e.save(),this._matrix.applyToContext(e),this._scope.project.draw(e),e.restore(),this._redrawNeeded&&(this._redrawNeeded=!1,this._scope._redrawNotified=!1),!0},projectToView:function(t){return this._matrix._transformPoint(Point.read(arguments))},viewToProject:function(t){return this._getInverse()._transformPoint(Point.read(arguments))},_getInverse:function(){return this._inverse||(this._inverse=this._matrix.createInverse()),this._inverse},getOnFrame:function(){return this._onFrame},setOnFrame:function(t){if(this._onFrame=t,!t)return void delete this._onFrameCallback;var e,n=this,i=!1,r=0,s=0;this._onFrameCallback=function(t,o){if(i=!1,n._onFrame){paper=n._scope,i=!0,o||DomEvent.requestAnimationFrame(n._onFrameCallback,n._canvas);var a=Date.now()/1e3,u=e?a-e:0;n._onFrame(Base.merge({delta:u,time:r+=u,count:s++})),e=a,n.draw(!0)}},i||this._onFrameCallback()},onResize:null},{statics:{_views:{},_id:0}},new function(){function t(t,e){return t.viewToProject(DomEvent.getOffset(e,t._canvas))}function e(){View._focused&&View._focused.isVisible()||PaperScope.each(function(t){for(var e=0,n=t.views.length;n>e;e++){var i=t.views[e];if(i.isVisible())throw View._focused=u=i,Base.stop}})}function n(n){var i;if(h||(i=View._views[DomEvent.getTarget(n).getAttribute("id")],i?View._focused=u=i:u&&u==View._focused&&(View._focused=null,e())),(i=i||View._focused)&&(s=i._scope.tool)){var r=n&&t(i,n),o=!(s.onMouseDrag||!s.onMouseMove);h&&!o?(a=r||a,a&&s.onHandleEvent("mousedrag",a,n)&&(i.draw(!0),DomEvent.stop(n))):h&&!o||!s.onHandleEvent("mousemove",r,n)||(i.draw(!0),DomEvent.stop(n))}}function i(e){var n=View._focused;n&&h&&(h=!1,a=null,s&&(null!=o&&(o=clearInterval(o)),s.onHandleEvent("mouseup",t(n,e),e)&&(n.draw(!0),DomEvent.stop(e))))}function r(t){h&&DomEvent.stop(t)}var s,o,a,u,h=!1;return DomEvent.add(document,{mousemove:n,mouseup:i,touchmove:n,touchend:i,selectstart:r,scroll:e}),DomEvent.add(window,{load:e}),{_createEvents:function(){function e(e){View._focused=i,(s=i._scope.tool)&&(a=t(i,e),s.onHandleEvent("mousedown",a,e)&&i.draw(!0),null!=s.eventInterval&&(o=setInterval(n,s.eventInterval)),h=!0)}var i=this;return{mousedown:e,touchstart:e,selectstart:r}},statics:{updateFocus:e}}}),Event=this.Event=Base.extend({initialize:function(t){this.event=t},preventDefault:function(){DomEvent.preventDefault(this.event)},stopPropagation:function(){DomEvent.stopPropagation(this.event)},stop:function(){DomEvent.stop(this.event)},getModifiers:function(){return Key.modifiers}}),KeyEvent=this.KeyEvent=Event.extend(new function(){return{initialize:function(t,e,n,i){this.base(i),this.type=t?"keydown":"keyup",this.key=e,this.character=n},toString:function(){return"{ type: "+this.type+", key: "+this.key+", character: "+this.character+", modifiers: "+this.getModifiers()+" }"}}}),Key=this.Key=new function(){function t(t,e,i,r){var o=String.fromCharCode(i),a=n[e]||o.toLowerCase(),u=t?"onKeyDown":"onKeyUp",h=View._focused,l=h&&h.isVisible()&&h._scope,c=l&&l.tool;if(s[a]=t,c&&c[u]){var d=new KeyEvent(t,a,o,r);c[u](d)===!1&&d.preventDefault(),h&&h.draw(!0)}}var e,n={8:"backspace",13:"enter",16:"shift",17:"control",18:"option",19:"pause",20:"caps-lock",27:"escape",32:"space",35:"end",36:"home",37:"left",38:"up",39:"right",40:"down",46:"delete",91:"command",93:"command",224:"command"},i=Base.merge({shift:!1,control:!1,option:!1,command:!1,capsLock:!1}),r={},s={};return DomEvent.add(document,{keydown:function(s){var o,a=s.which||s.keyCode,u=n[a];u?((o=Base.camelize(u))in i&&(i[o]=!0),r[a]=0,t(!0,a,null,s)):e=a},keypress:function(n){if(null!=e){var i=n.which||n.keyCode;r[e]=i,t(!0,e,i,n),e=null}},keyup:function(e){var s,o=e.which||e.keyCode,a=n[o];a&&(s=Base.camelize(a))in i&&(i[s]=!1),null!=r[o]&&(t(!1,o,r[o],e),delete r[o])}}),{modifiers:i,isDown:function(t){return!!s[t]}}},ToolEvent=this.ToolEvent=Event.extend({initialize:function(t,e,n){this.tool=t,this.type=e,this.event=n},_choosePoint:function(t,e){return t?t:e?e.clone():null},getPoint:function(){return this._choosePoint(this._point,this.tool._point)},setPoint:function(t){this._point=t},getLastPoint:function(){return this._choosePoint(this._lastPoint,this.tool._lastPoint)},setLastPoint:function(t){this._lastPoint=t},getDownPoint:function(){return this._choosePoint(this._downPoint,this.tool._downPoint)},setDownPoint:function(t){this._downPoint=t},getMiddlePoint:function(){return!this._middlePoint&&this.tool._lastPoint?this.tool._point.add(this.tool._lastPoint).divide(2):this.middlePoint},setMiddlePoint:function(t){this._middlePoint=t},getDelta:function(){return!this._delta&&this.tool._lastPoint?this.tool._point.subtract(this.tool._lastPoint):this._delta},setDelta:function(t){this._delta=t},getCount:function(){return/^mouse(down|up)$/.test(this.type)?this.tool._downCount:this.tool._count},setCount:function(t){this.tool[/^mouse(down|up)$/.test(this.type)?"downCount":"count"]=t},getItem:function(){if(!this._item){var t=this.tool._scope.project.hitTest(this.getPoint());if(t){for(var e=t.item,n=e._parent;n instanceof Group&&!(n instanceof Layer)||n instanceof CompoundPath;)e=n,n=n._parent;this._item=e}}return this._item},setItem:function(t){this._item=t},toString:function(){return"{ type: "+this.type+", point: "+this.getPoint()+", count: "+this.getCount()+", modifiers: "+this.getModifiers()+" }"}}),Tool=this.Tool=PaperScopeItem.extend({_list:"tools",_reference:"tool",initialize:function(){this.base(),this._firstMove=!0,this._count=0,this._downCount=0},eventInterval:null,getMinDistance:function(){return this._minDistance},setMinDistance:function(t){this._minDistance=t,null!=this._minDistance&&null!=this._maxDistance&&this._minDistance>this._maxDistance&&(this._maxDistance=this._minDistance)},getMaxDistance:function(){return this._maxDistance},setMaxDistance:function(t){this._maxDistance=t,null!=this._minDistance&&null!=this._maxDistance&&this._maxDistance<this._minDistance&&(this._minDistance=t)},getFixedDistance:function(){return this._minDistance==this._maxDistance?this._minDistance:null},setFixedDistance:function(t){this._minDistance=t,this._maxDistance=t},updateEvent:function(t,e,n,i,r,s,o){if(!r){if(null!=n||null!=i){var a=null!=n?n:0,u=e.subtract(this._point),h=u.getLength();if(a>h)return!1;var l=null!=i?i:0;if(0!=l)if(h>l)e=this._point.add(u.normalize(l));else if(o)return!1}if(s&&e.equals(this._point))return!1}switch(this._lastPoint=r&&"mousemove"==t?e:this._point,this._point=e,t){case"mousedown":this._lastPoint=this._downPoint,this._downPoint=this._point,this._downCount++;break;case"mouseup":this._lastPoint=this._downPoint}return this._count=r?0:this._count+1,!0},onHandleEvent:function(t,e,n){paper=this._scope;var i=!1;switch(t){case"mousedown":this.updateEvent(t,e,null,null,!0,!1,!1),this.onMouseDown&&(this.onMouseDown(new ToolEvent(this,t,n)),i=!0);break;case"mousedrag":for(var r=!1,s=!1;this.updateEvent(t,e,this.minDistance,this.maxDistance,!1,r,s);)this.onMouseDrag&&(this.onMouseDrag(new ToolEvent(this,t,n)),i=!0),r=!0,s=!0;break;case"mouseup":this._point.x==e.x&&this._point.y==e.y||!this.updateEvent("mousedrag",e,this.minDistance,this.maxDistance,!1,!1,!1)||this.onMouseDrag&&(this.onMouseDrag(new ToolEvent(this,t,n)),i=!0),this.updateEvent(t,e,null,this.maxDistance,!1,!1,!1),this.onMouseUp&&(this.onMouseUp(new ToolEvent(this,t,n)),i=!0),this.updateEvent(t,e,null,null,!0,!1,!1),this._firstMove=!0;break;case"mousemove":for(;this.updateEvent(t,e,this.minDistance,this.maxDistance,this._firstMove,!0,!1);)this.onMouseMove&&(this.onMouseMove(new ToolEvent(this,t,n)),i=!0),this._firstMove=!1}return i}}),CanvasProvider={canvases:[],getCanvas:function(t){if(this.canvases.length){var e=this.canvases.pop();return e.width!=t.width||e.height!=t.height?(e.width=t.width,e.height=t.height):e.getContext("2d").clearRect(0,0,t.width+1,t.height+1),e}var e=document.createElement("canvas");return e.width=t.width,e.height=t.height,e},returnCanvas:function(t){this.canvases.push(t)}},Numerical=new function(){var t=[[.5773502691896257],[0,.7745966692414834],[.33998104358485626,.8611363115940526],[0,.5384693101056831,.906179845938664],[.2386191860831969,.6612093864662645,.932469514203152],[0,.4058451513773972,.7415311855993945,.9491079123427585],[.1834346424956498,.525532409916329,.7966664774136267,.9602898564975363],[0,.3242534234038089,.6133714327005904,.8360311073266358,.9681602395076261],[.14887433898163122,.4333953941292472,.6794095682990244,.8650633666889845,.9739065285171717],[0,.26954315595234496,.5190961292068118,.7301520055740494,.8870625997680953,.978228658146057],[.1252334085114689,.3678314989981802,.5873179542866175,.7699026741943047,.9041172563704749,.9815606342467192],[0,.2304583159551348,.44849275103644687,.6423493394403402,.8015780907333099,.9175983992229779,.9841830547185881],[.10805494870734367,.31911236892788974,.5152486363581541,.6872929048116855,.827201315069765,.9284348836635735,.9862838086968123],[0,.20119409399743451,.3941513470775634,.5709721726085388,.7244177313601701,.8482065834104272,.937273392400706,.9879925180204854],[.09501250983763744,.2816035507792589,.45801677765722737,.6178762444026438,.755404408355003,.8656312023878318,.9445750230732326,.9894009349916499]],e=[[1],[.8888888888888888,.5555555555555556],[.6521451548625461,.34785484513745385],[.5688888888888889,.47862867049936647,.23692688505618908],[.46791393457269104,.3607615730481386,.17132449237917036],[.4179591836734694,.3818300505051189,.27970539148927664,.1294849661688697],[.362683783378362,.31370664587788727,.22238103445337448,.10122853629037626],[.3302393550012598,.31234707704000286,.26061069640293544,.1806481606948574,.08127438836157441],[.29552422471475287,.26926671930999635,.21908636251598204,.1494513491505806,.06667134430868814],[.2729250867779006,.26280454451024665,.23319376459199048,.18629021092773426,.1255803694649046,.05566856711617366],[.24914704581340277,.2334925365383548,.20316742672306592,.16007832854334622,.10693932599531843,.04717533638651183],[.2325515532308739,.22628318026289723,.2078160475368885,.17814598076194574,.13887351021978725,.09212149983772845,.04048400476531588],[.2152638534631578,.2051984637212956,.18553839747793782,.15720316715819355,.12151857068790319,.08015808715976021,.03511946033175186],[.2025782419255613,.19843148532711158,.1861610000155622,.16626920581699392,.13957067792615432,.10715922046717194,.07036604748810812,.03075324199611727],[.1894506104550685,.18260341504492358,.16915651939500254,.14959598881657674,.12462897125553388,.09515851168249279,.062253523938647894,.027152459411754096]],n=Math.abs,i=Math.sqrt,r=Math.cos,s=Math.PI;return{TOLERANCE:1e-5,EPSILON:1e-11,integrate:function(n,i,r,s){for(var o=t[s-2],a=e[s-2],u=.5*(r-i),h=u+i,l=0,c=s+1>>1,d=1&s?a[l++]*n(h):0;c>l;){var f=u*o[l];d+=a[l++]*(n(h+f)+n(h-f))}return u*d},findRoot:function(t,e,i,r,s,o,a){for(var u=0;o>u;u++){var h=t(i),l=h/e(i);if(n(l)<a)return i;var c=i-l;h>0?(s=i,i=r>=c?.5*(r+s):c):(r=i,i=c>=s?.5*(r+s):c)}},solveQuadratic:function(t,e,r,s,o){if(n(t)<o)return n(e)>=o?(s[0]=-r/e,1):n(r)<o?-1:0;var a=e*e-4*t*r;if(0>a)return 0;a=i(a),0>e&&(a=-a),a=(e+a)*-.5;var u=0;return n(a)>=o&&(s[u++]=r/a),n(t)>=o&&(s[u++]=a/t),u},solveCubic:function(t,e,o,a,u,h){if(n(t)<h)return Numerical.solveQuadratic(e,o,a,u,h);e/=t,o/=t,a/=t;var l=(e*e-3*o)/9,c=(2*e*e*e-9*e*o+27*a)/54,d=l*l*l,f=c*c;if(e/=3,d>f){var g=Math.acos(c/i(d)),p=-2*i(l);return u[0]=p*r(g/3)-e,u[1]=p*r((g+2*s)/3)-e,u[2]=p*r((g-2*s)/3)-e,3}var _=-Math.pow(n(c)+i(f-d),1/3);0>c&&(_=-_);var m=n(_)<h?0:l/_;return u[0]=_+m-e,1}}},BlendMode={process:function(t,e,n,i,r){function s(t,e,n){return.2989*t+.587*e+.114*n}function o(t,e,n,i){var r=i-s(t,e,n);m=t+r,v=e+r,y=n+r;var i=s(m,v,y),o=S(m,v,y),a=C(m,v,y);if(0>o){var u=i-o;m=i+(m-i)*i/u,v=i+(v-i)*i/u,y=i+(y-i)*i/u}if(a>255){var h=255-i,l=a-i;m=i+(m-i)*h/l,v=i+(v-i)*h/l,y=i+(y-i)*h/l}}function a(t,e,n){return C(t,e,n)-S(t,e,n)}function u(t,e,n,i){var r,s=[t,e,n],o=C(t,e,n),a=S(t,e,n);a=a==t?0:a==e?1:2,o=o==t?0:o==e?1:2,r=0==S(a,o)?1==C(a,o)?2:1:0,s[o]>s[a]?(s[r]=(s[r]-s[a])*i/(s[o]-s[a]),s[o]=i):s[r]=s[o]=0,s[a]=0,m=s[0],v=s[1],y=s[2]}var h,l,c,d,f,g,p,_,m,v,y,w=e.canvas,x=n.getImageData(r.x,r.y,w.width,w.height),P=x.data,b=e.getImageData(0,0,w.width,w.height).data,S=Math.min,C=Math.max,E=Math.abs,M={multiply:function(){m=f*h/255,v=g*l/255,y=p*c/255},screen:function(){m=255-(255-f)*(255-h)/255,v=255-(255-g)*(255-l)/255,y=255-(255-p)*(255-c)/255},overlay:function(){m=128>f?2*f*h/255:255-2*(255-f)*(255-h)/255,v=128>g?2*g*l/255:255-2*(255-g)*(255-l)/255,y=128>p?2*p*c/255:255-2*(255-p)*(255-c)/255},"soft-light":function(){var t=h*f/255;m=t+f*(255-(255-f)*(255-h)/255-t)/255,t=l*g/255,v=t+g*(255-(255-g)*(255-l)/255-t)/255,t=c*p/255,y=t+p*(255-(255-p)*(255-c)/255-t)/255},"hard-light":function(){m=128>h?2*h*f/255:255-2*(255-h)*(255-f)/255,v=128>l?2*l*g/255:255-2*(255-l)*(255-g)/255,y=128>c?2*c*p/255:255-2*(255-c)*(255-p)/255},"color-dodge":function(){m=255==h?h:S(255,255*f/(255-h)),v=255==l?l:S(255,255*g/(255-l)),y=255==c?c:S(255,255*p/(255-c))},"color-burn":function(){m=0==h?0:C(255-255*(255-f)/h,0),v=0==l?0:C(255-255*(255-g)/l,0),y=0==c?0:C(255-255*(255-p)/c,0)},darken:function(){m=h>f?f:h,v=l>g?g:l,y=c>p?p:c},lighten:function(){m=f>h?f:h,v=g>l?g:l,y=p>c?p:c},difference:function(){m=f-h,0>m&&(m=-m),v=g-l,0>v&&(v=-v),y=p-c,0>y&&(y=-y)},exclusion:function(){m=f+h*(255-f-f)/255,v=g+l*(255-g-g)/255,y=p+c*(255-p-p)/255},hue:function(){u(h,l,c,a(f,g,p)),o(m,v,y,s(f,g,p))},saturation:function(){u(f,g,p,a(h,l,c)),o(m,v,y,s(f,g,p))},luminosity:function(){o(f,g,p,s(h,l,c))},color:function(){o(h,l,c,s(f,g,p))},add:function(){m=S(f+h,255),v=S(g+l,255),y=S(p+c,255)},subtract:function(){m=C(f-h,0),v=C(g-l,0),y=C(p-c,0)},average:function(){m=(f+h)/2,v=(g+l)/2,y=(p+c)/2},negation:function(){m=255-E(255-h-f),v=255-E(255-l-g),y=255-E(255-c-p)}},T=M[t];if(T){for(var k=0,O=P.length;O>k;k+=4){h=b[k],f=P[k],l=b[k+1],g=P[k+1],c=b[k+2],p=P[k+2],d=b[k+3],_=P[k+3],T();var I=d*i/255,L=1-I;P[k]=I*m+L*f,P[k+1]=I*v+L*g,P[k+2]=I*y+L*p,P[k+3]=d*i+L*_}n.putImageData(x,r.x,r.y)}}},PaperScript=this.PaperScript=new function(){function $eval(t,e,n){var i=operators[e];if(t&&t[i]){var r=t[i](n);return"!="==e?!r:r}switch(e){case"+":return t+n;case"-":return t-n;case"*":return t*n;case"/":return t/n;case"%":return t%n;case"==":return t==n;case"!=":return t!=n;default:throw new Error("Implement Operator: "+e)}}function $sign(t,e){var n=signOperators[t];if(e&&e[n])return e[n]();switch(t){case"+":return+e;case"-":return-e;default:throw new Error("Implement Sign Operator: "+t)}}function isDynamic(t){var e=t[0];return"num"!=e&&"string"!=e}function handleOperator(t,e,n){return operators[t]&&isDynamic(e)?["call",["name","$eval"],[e,["string",t],n]]:void 0}function compile(t){var e=parse_js.parse(t),n=parse_js.ast_walker(),i=n.walk;return e=n.with_walkers({binary:function(t,e,n){return handleOperator(t,e=i(e),n=i(n))||[this[0],t,e,n]},assign:function(t,e,n){var r=handleOperator(t,e=i(e),n=i(n));return r?[this[0],!0,e,r]:[this[0],t,e,n]},"unary-prefix":function(t,e){return signOperators[t]&&isDynamic(e)?["call",["name","$sign"],[["string",t],i(e)]]:void 0}},function(){return i(e)}),parse_js.gen_code(e,{beautify:!0})}function evaluate(code,scope){paper=scope;var view=scope.view,tool=/on(?:Key|Mouse)(?:Up|Down|Move|Drag)/.test(code)&&new Tool,res;with(scope)(function(){var onEditOptions,onSelect,onDeselect,onReselect,onMouseDown,onMouseUp,onMouseDrag,onMouseMove,onKeyDown,onKeyUp,onFrame,onResize,handlers=["onEditOptions","onSelect","onDeselect","onReselect","onMouseDown","onMouseUp","onMouseDrag","onMouseMove","onKeyDown","onKeyUp"];res=eval(compile(code)),tool&&Base.each(handlers,function(key){tool[key]=eval(key)}),view&&(view.onResize=onResize,view.setOnFrame(onFrame),view.draw())}).call(scope);return res}function request(t,e){var n=new(window.ActiveXObject||XMLHttpRequest)("Microsoft.XMLHTTP");return n.open("GET",t,!0),n.overrideMimeType&&n.overrideMimeType("text/plain"),n.onreadystatechange=function(){return 4===n.readyState?evaluate(n.responseText,e):void 0},n.send(null)}function load(){for(var t=document.getElementsByTagName("script"),e=0,n=t.length;n>e;e++){var i=t[e];if(/^text\/(?:x-|)paperscript$/.test(i.type)&&!i.getAttribute("data-paper-loaded")){var r=new PaperScope(i);r.setup(PaperScript.getAttribute(i,"canvas")),i.src?request(i.src,r):evaluate(i.innerHTML,r),i.setAttribute("data-paper-loaded",!0)}}}function handleAttribute(t){return t+="Attribute",function(e,n){return e[t](n)||e[t]("data-paper-"+n)}}var parse_js=new function(){function t(t,e,n){for(var i=[],r=0;r<t.length;++r)i.push(e.call(n,t[r],r));return i}function e(t){return/^[a-z_$][a-z0-9_$]*$/i.test(t)&&"this"!=t&&!u(O,t)&&!u(T,t)&&!u(M,t)}function n(t,e){var n={};t===!0&&(t={});for(var i in e)u(e,i)&&(n[i]=t&&u(t,i)?t[i]:e[i]);return n}function i(t,e){return 1>e?"":Array(e+1).join(t)}function r(r,l){function d(t){var e=t[0],n=B[e];if(!n)throw new Error("Can't find generator for \""+e+'"');z.push(t);var i=n.apply(e,t.slice(1));return z.pop(),i}function f(t){var e=t[0],n=t[1];return null!=n&&(e=C([T(e),"=",P(n,"seq")])),e}function g(t){return t?0==t.length?"{}":"{"+I+E(function(){return _(t).join(I)})+I+M("}"):";"}function p(e){var n=e.length;return 0==n?"{}":"{"+I+t(e,function(t,e){var i=t[1].length>0,r=E(function(){return M(t[0]?C(["case",d(t[0])+":"]):"default:")},.5)+(i?I+E(function(){return _(t[1]).join(I)}):"");return!k&&i&&n-1>e&&(r+=";"),r}).join(I)+I+M("}")}function _(e,n){for(var i=[],r=e.length-1,s=0;r>=s;++s){var a=e[s],u=d(a);";"!=u&&(!k&&s==r&&(u="while"==a[0]&&o(a[2])||h(a[0],["for","for-in"])&&o(a[4])||"if"==a[0]&&o(a[2])&&!a[3]||"if"==a[0]&&a[3]&&o(a[3])?u.replace(/;*\s*$/,";"):u.replace(/;+\s*$/,"")),i.push(u))}return n?i:t(i,M)}function m(e,n,i,r){var s=r||"function";return e&&(s+=" "+T(e)),s+="("+b(t(n,T))+")",C([s,g(i)])}function v(t){if("do"==t[0])return d(["block",[t]]);for(var e=t;;){var n=e[0];if("if"==n){if(!e[3])return d(["block",[t]]);e=e[3]}else if("while"==n||"do"==n)e=e[2];else{if("for"!=n&&"for-in"!=n)break;e=e[4]}}return d(t)}function y(t){var e,n=t.toString(10),i=[n.replace(/^0\./,".")];return Math.floor(t)===t?(i.push("0x"+t.toString(16).toLowerCase(),"0"+t.toString(8)),(e=/^(.*?)(0+)$/.exec(t))&&i.push(e[1]+"e"+e[2].length)):(e=/^0?\.(0+)(.*)$/.exec(t))&&i.push(e[2]+"e-"+(e[1].length+e[2].length),n.substr(n.indexOf("."))),   x(i)}function w(t){if("function"==t[0]||"object"==t[0])for(var e=c(z),n=e.pop(),i=e.pop();i;){if("stat"==i[0])return!0;if(("seq"!=i[0]&&"call"!=i[0]&&"dot"!=i[0]&&"sub"!=i[0]&&"conditional"!=i[0]||i[1]!==n)&&("binary"!=i[0]&&"assign"!=i[0]&&"unary-postfix"!=i[0]||i[2]!==n))return!1;n=i,i=e.pop()}return!u(Y,t[0])}function x(t){if(1==t.length)return t[0];if(2==t.length){var e=t[1];return t=t[0],t.length<=e.length?t:e}return x([t[0],x(t.slice(1))])}function P(t){for(var e=d(t),n=1;n<arguments.length;++n){var i=arguments[n];if(i instanceof Function&&i(t)||t[0]==i)return"("+e+")"}return e}function b(t){return t.join(","+L)}function C(t){if(k)return t.join(" ");for(var e=[],n=0;n<t.length;++n){var i=t[n+1];e.push(t[n]),i&&(/[a-z0-9_\x24]$/i.test(t[n].toString())&&/^[a-z0-9_\x24]/i.test(i.toString())||/[\+\-]$/.test(t[n].toString())&&/^[\+\-]/.test(i.toString()))&&e.push(" ")}return e.join("")}function E(t,e){null==e&&(e=1),O+=e;try{return t.apply(null,c(arguments,1))}finally{O-=e}}function M(t){return null==t&&(t=""),k&&(t=i(" ",l.indent_start+O*l.indent_level)+t),t}function T(t){return t.toString()}l=n(l,{indent_start:0,indent_level:4,quote_keys:!1,space_colon:!1,beautify:!1});var k=!!l.beautify,O=0,I=k?"\n":"",L=k?" ":"",B={string:s,num:y,name:T,toplevel:function(t){return _(t).join(I)},splice:function(e){var n=z[z.length-2][0];return u($,n)?g.apply(this,arguments):t(_(e,!0),function(t,e){return e>0?M(t):t}).join(I)},block:g,"var":function(e){return"var "+b(t(e,f))+";"},"const":function(e){return"const "+b(t(e,f))+";"},"try":function(t,e,n){var i=["try",g(t)];return e&&i.push("catch","("+e[0]+")",g(e[1])),n&&i.push("finally",g(n)),C(i)},"throw":function(t){return C(["throw",d(t)])+";"},"new":function(e,n){return n=n.length>0?"("+b(t(n,d))+")":"",C(["new",P(e,"seq","binary","conditional","assign",function(t){var e=a(),n={};try{e.with_walkers({call:function(){throw n},"function":function(){return this}},function(){e.walk(t)})}catch(i){if(i===n)return!0;throw i}})+n])},"switch":function(t,e){return C(["switch","("+d(t)+")",p(e)])},"break":function(t){var e="break";return null!=t&&(e+=" "+T(t)),e+";"},"continue":function(t){var e="continue";return null!=t&&(e+=" "+T(t)),e+";"},conditional:function(t,e,n){return C([P(t,"assign","seq","conditional"),"?",P(e,"seq"),":",P(n,"seq")])},assign:function(t,e,n){return t&&t!==!0?t+="=":t="=",C([d(e),t,P(n,"seq")])},dot:function(t){var e=d(t),n=1;for("num"==t[0]?/\./.test(t[1])||(e+="."):w(t)&&(e="("+e+")");n<arguments.length;)e+="."+T(arguments[n++]);return e},call:function(e,n){var i=d(e);return w(e)&&(i="("+i+")"),i+"("+b(t(n,function(t){return P(t,"seq")}))+")"},"function":m,defun:m,"if":function(t,e,n){var i=["if","("+d(t)+")",n?v(e):d(e)];return n&&i.push("else",d(n)),C(i)},"for":function(t,e,n,i){var r=["for"];t=(null!=t?d(t):"").replace(/;*\s*$/,";"+L),e=(null!=e?d(e):"").replace(/;*\s*$/,";"+L),n=(null!=n?d(n):"").replace(/;*\s*$/,"");var s=t+e+n;return"; ; "==s&&(s=";;"),r.push("("+s+")",d(i)),C(r)},"for-in":function(t,e,n,i){return C(["for","("+(t?d(t).replace(/;+$/,""):d(e)),"in",d(n)+")",d(i)])},"while":function(t,e){return C(["while","("+d(t)+")",d(e)])},"do":function(t,e){return C(["do",d(e),"while","("+d(t)+")"])+";"},"return":function(t){var e=["return"];return null!=t&&e.push(d(t)),C(e)+";"},binary:function(t,e,n){var i=d(e),r=d(n);return(h(e[0],["assign","conditional","seq"])||"binary"==e[0]&&W[t]>W[e[1]])&&(i="("+i+")"),(h(n[0],["assign","conditional","seq"])||"binary"==n[0]&&W[t]>=W[n[1]]&&(n[1]!=t||!h(t,["&&","||","*"])))&&(r="("+r+")"),C([i,t,r])},"unary-prefix":function(t,e){var n=d(e);return"num"==e[0]||"unary-prefix"==e[0]&&!u(A,t+e[1])||!w(e)||(n="("+n+")"),t+(S(t.charAt(0))?" ":"")+n},"unary-postfix":function(t,e){var n=d(e);return"num"==e[0]||"unary-postfix"==e[0]&&!u(A,t+e[1])||!w(e)||(n="("+n+")"),n+t},sub:function(t,e){var n=d(t);return w(t)&&(n="("+n+")"),n+"["+d(e)+"]"},object:function(n){return 0==n.length?"{}":"{"+I+E(function(){return t(n,function(t){if(3==t.length)return M(m(t[0],t[1][2],t[1][3],t[2]));var n=t[0],i=d(t[1]);return l.quote_keys?n=s(n):("number"==typeof n||!k&&+n+""==n)&&parseFloat(n)>=0?n=y(+n):e(n)||(n=s(n)),M(C(k&&l.space_colon?[n,":",i]:[n+":",i]))}).join(","+I)})+I+M("}")},regexp:function(t,e){return"/"+t+"/"+e},array:function(e){return 0==e.length?"[]":C(["[",b(t(e,function(t){return k||"atom"!=t[0]||"undefined"!=t[1]?P(t,"seq"):""})),"]"])},stat:function(t){return d(t).replace(/;*\s*$/,";")},seq:function(){return b(t(c(arguments),d))},label:function(t,e){return C([T(t),":",d(e)])},"with":function(t,e){return C(["with","("+d(t)+")",d(e)])},atom:function(t){return T(t)}},z=[];return d(r)}function s(t){var e=0,n=0;return t=t.replace(/[\\\b\f\n\r\t\x22\x27]/g,function(t){switch(t){case"\\":return"\\\\";case"\b":return"\\b";case"\f":return"\\f";case"\n":return"\\n";case"\r":return"\\r";case"	":return"\\t";case'"':return++e,'"';case"'":return++n,"'"}return t}),e>n?"'"+t.replace(/\x27/g,"\\'")+"'":'"'+t.replace(/\x22/g,'\\"')+'"'}function o(t){return!t||"block"==t[0]&&(!t[1]||0==t[1].length)}function a(){function e(t,e){var n,i={};for(n in t)u(t,n)&&(i[n]=o[n],o[n]=t[n]);var r=e();for(n in i)u(i,n)&&(i[n]?o[n]=i[n]:delete o[n]);return r}function n(t){if(null==t)return null;try{a.push(t);var e=t[0],n=o[e];if(n){var i=n.apply(t,t.slice(1));if(null!=i)return i}return n=s[e],n.apply(t,t.slice(1))}finally{a.pop()}}function i(e){var i=[this[0]];return null!=e&&i.push(t(e,n)),i}function r(e){return[this[0],t(e,function(t){var e=[t[0]];return t.length>1&&(e[1]=n(t[1])),e})]}var s={string:function(t){return[this[0],t]},num:function(t){return[this[0],t]},name:function(t){return[this[0],t]},toplevel:function(e){return[this[0],t(e,n)]},block:i,splice:i,"var":r,"const":r,"try":function(e,i,r){return[this[0],t(e,n),null!=i?[i[0],t(i[1],n)]:null,null!=r?t(r,n):null]},"throw":function(t){return[this[0],n(t)]},"new":function(e,i){return[this[0],n(e),t(i,n)]},"switch":function(e,i){return[this[0],n(e),t(i,function(e){return[e[0]?n(e[0]):null,t(e[1],n)]})]},"break":function(t){return[this[0],t]},"continue":function(t){return[this[0],t]},conditional:function(t,e,i){return[this[0],n(t),n(e),n(i)]},assign:function(t,e,i){return[this[0],t,n(e),n(i)]},dot:function(t){return[this[0],n(t)].concat(c(arguments,1))},call:function(e,i){return[this[0],n(e),t(i,n)]},"function":function(e,i,r){return[this[0],e,i.slice(),t(r,n)]},defun:function(e,i,r){return[this[0],e,i.slice(),t(r,n)]},"if":function(t,e,i){return[this[0],n(t),n(e),n(i)]},"for":function(t,e,i,r){return[this[0],n(t),n(e),n(i),n(r)]},"for-in":function(t,e,i,r){return[this[0],n(t),n(e),n(i),n(r)]},"while":function(t,e){return[this[0],n(t),n(e)]},"do":function(t,e){return[this[0],n(t),n(e)]},"return":function(t){return[this[0],n(t)]},binary:function(t,e,i){return[this[0],t,n(e),n(i)]},"unary-prefix":function(t,e){return[this[0],t,n(e)]},"unary-postfix":function(t,e){return[this[0],t,n(e)]},sub:function(t,e){return[this[0],n(t),n(e)]},object:function(e){return[this[0],t(e,function(t){return 2==t.length?[t[0],n(t[1])]:[t[0],n(t[1]),t[2]]})]},regexp:function(t,e){return[this[0],t,e]},array:function(e){return[this[0],t(e,n)]},stat:function(t){return[this[0],n(t)]},seq:function(){return[this[0]].concat(t(c(arguments),n))},label:function(t,e){return[this[0],t,n(e)]},"with":function(t,e){return[this[0],n(t),n(e)]},atom:function(t){return[this[0],t]}},o={},a=[];return{walk:n,with_walkers:e,parent:function(){return a[a.length-2]},stack:function(){return a}}}function u(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function h(t,e){for(var n=e.length;--n>=0;)if(e[n]===t)return!0;return!1}function l(t){return t.split("")}function c(t,e){return Array.prototype.slice.call(t,e||0)}function d(t){for(var e={},n=0;n<t.length;++n)e[t[n]]=!0;return e}function f(t){t instanceof Function&&(t=t());for(var e=1,n=arguments.length;--n>0;++e)arguments[e]();return t}function g(t){var e=c(arguments,1);return function(){return t.apply(this,e.concat(c(arguments)))}}function p(t,e,n){function i(t){try{return++st.in_loop,t()}finally{--st.in_loop}}function r(t){var e=o(t),n=st.token.value;if(rt("operator")&&u(q,n)){if(s(e))return nt(),Y("assign",q[n],e,r(t));tt("Invalid assignment")}return e}function s(t){if(!e)return!0;switch(t[0]){case"dot":case"sub":case"new":case"call":return!0;case"name":return"this"!=t[1]}}function o(t){var e=a(t);if(rt("operator","?")){nt();var n=lt(!1);return Z(":"),Y("conditional",e,n,lt(!1,t))}return e}function a(t){return l(ht(!0),0,t)}function l(t,e,n){var i=rt("operator")?st.token.value:null;i&&"in"==i&&n&&(i=null);var r=null!=i?W[i]:null;if(null!=r&&r>e){nt();var s=l(ht(!0),r,n);return l(Y("binary",i,t,s),e,n)}return t}function d(t,e,n){return("++"==e||"--"==e)&&!s(n)&&tt("Invalid use of "+e+" operator"),Y(t,e,n)}function p(t,e){return rt("punc",".")?(nt(),p(Y("dot",t,w()),e)):rt("punc","[")?(nt(),p(Y("sub",t,f(lt,g(Z,"]"))),e)):e&&rt("punc","(")?(nt(),p(Y("call",t,S(")")),!0)):e&&rt("operator")&&u(j,st.token.value)?f(g(d,"unary-postfix",st.token.value,t),nt):t}function w(){switch(st.token.type){case"name":case"operator":case"keyword":case"atom":return f(st.token.value,nt);default:J()}}function x(){switch(st.token.type){case"num":case"string":return f(st.token.value,nt)}return w()}function P(){for(var t=!0,n=[];!rt("punc","}")&&(t?t=!1:Z(","),e||!rt("punc","}"));){var i=st.token.type,r=x();"name"!=i||"get"!=r&&"set"!=r||rt("punc",":")?(Z(":"),n.push([r,lt(!1)])):n.push([w(),at(!1),r])}return nt(),Y("object",n)}function b(){return Y("array",S("]",!e,!0))}function S(t,e,n){for(var i=!0,r=[];!rt("punc",t)&&(i?i=!1:Z(","),!e||!rt("punc",t));)rt("punc",",")&&n?r.push(["atom","undefined"]):r.push(lt(!1));return nt(),r}function C(){var t,e=ht(!1);return rt("punc","(")?(nt(),t=S(")")):t=[],p(Y("new",e,t),!0)}function E(){return Y("const",T())}function M(t){return Y("var",T(t))}function T(t){for(var e=[];;){rt("name")||J();var n=st.token.value;if(nt(),rt("operator","=")?(nt(),e.push([n,lt(!1,t)])):e.push([n]),!rt("punc",","))break;nt()}return e}function k(){var t,e,n=O();if(rt("keyword","catch")){nt(),Z("("),rt("name")||tt("Name expected");var i=st.token.value;nt(),Z(")"),t=[i,O()]}return rt("keyword","finally")&&(nt(),e=O()),!t&&!e&&tt("Missing catch/finally blocks"),Y("try",n,t,e)}function O(){Z("{");for(var t=[];!rt("punc","}");)rt("eof")&&J(),t.push(ot());return nt(),t}function I(){var t,e=H(),n=ot();return rt("keyword","else")&&(nt(),t=ot()),Y("if",e,n,t)}function L(t){var e="var"==t[0]?Y("name",t[1][0]):t;nt();var n=lt();return Z(")"),Y("for-in",t,e,n,i(ot))}function B(t){Z(";");var e=rt("punc",";")?null:lt();Z(";");var n=rt("punc",")")?null:lt();return Z(")"),Y("for",t,e,n,i(ot))}function z(){Z("(");var t=null;return!rt("punc",";")&&(t=rt("keyword","var")?(nt(),M(!0)):lt(!0,!0),rt("operator","in"))?L(t):B(t)}function A(t){var e;return X()||(e=rt("name")?st.token.value:null),null!=e?(nt(),h(e,st.labels)||tt("Label "+e+" without matching loop or statement")):0==st.in_loop&&tt(t+" not inside a loop or switch"),$(),Y(t,e)}function D(){return Y("stat",f(lt,$))}function R(t){st.labels.push(t);var n=st.token,i=ot();return e&&!u(U,i[0])&&J(n),st.labels.pop(),Y("label",t,i)}function N(t){return n?function(){var e=st.token,n=t.apply(this,arguments);return n[0]=F(n[0],e,et()),n}:t}function F(t,e,n){return t instanceof _?t:new _(t,e,n)}function H(){Z("(");var t=lt();return Z(")"),t}function Y(){return c(arguments)}function $(){rt("punc",";")?nt():X()||J()}function X(){return!e&&(st.token.nlb||rt("eof")||rt("punc","}"))}function Z(t){return K("punc",t)}function K(t,e){return rt(t,e)?nt():void Q(st.token,"Unexpected token "+st.token.type+", expected "+t)}function J(t){null==t&&(t=st.token),Q(t,"Unexpected token: "+t.type+" ("+t.value+")")}function Q(t,e){tt(e,t.line,t.col)}function tt(t,e,n,i){var r=st.input.context();y(t,null!=e?e:r.tokline,null!=n?n:r.tokcol,null!=i?i:r.tokpos)}function et(){return st.prev}function nt(){return st.prev=st.token,st.peeked?(st.token=st.peeked,st.peeked=null):st.token=st.input(),st.token}function it(){return st.peeked||(st.peeked=st.input())}function rt(t,e){return v(st.token,t,e)}var st={input:"string"==typeof t?m(t,!0):t,token:null,prev:null,peeked:null,in_function:0,in_loop:0,labels:[]};st.token=nt();var ot=N(function(){switch(rt("operator","/")&&(st.peeked=null,st.token=st.input(!0)),st.token.type){case"num":case"string":case"regexp":case"operator":case"atom":return D();case"name":return v(it(),"punc",":")?R(f(st.token.value,nt,nt)):D();case"punc":switch(st.token.value){case"{":return Y("block",O());case"[":case"(":return D();case";":return nt(),Y("block");default:J()}case"keyword":switch(f(st.token.value,nt)){case"break":return A("break");case"continue":return A("continue");case"debugger":return $(),Y("debugger");case"do":return function(t){return K("keyword","while"),Y("do",f(H,$),t)}(i(ot));case"for":return z();case"function":return at(!0);case"if":return I();case"return":return 0==st.in_function&&tt("'return' outside of function"),Y("return",rt("punc",";")?(nt(),null):X()?null:f(lt,$));case"switch":return Y("switch",H(),ut());case"throw":return Y("throw",f(lt,$));case"try":return k();case"var":return f(M,$);case"const":return f(E,$);case"while":return Y("while",H(),i(ot));case"with":return Y("with",H(),ot());default:J()}}}),at=N(function(t){var e=rt("name")?f(st.token.value,nt):null;return t&&!e&&J(),Z("("),Y(t?"defun":"function",e,function(t,e){for(;!rt("punc",")");)t?t=!1:Z(","),rt("name")||J(),e.push(st.token.value),nt();return nt(),e}(!0,[]),function(){++st.in_function;var t=st.in_loop;st.in_loop=0;var e=O();return--st.in_function,st.in_loop=t,e}())}),ut=g(i,function(){Z("{");for(var t=[],e=null;!rt("punc","}");)rt("eof")&&J(),rt("keyword","case")?(nt(),e=[],t.push([lt(),e]),Z(":")):rt("keyword","default")?(nt(),Z(":"),e=[],t.push([null,e])):(e||J(),e.push(ot()));return nt(),t}),ht=N(function(t){if(rt("operator","new"))return nt(),C();if(rt("operator")&&u(V,st.token.value))return d("unary-prefix",f(st.token.value,nt),ht(t));if(rt("punc")){switch(st.token.value){case"(":return nt(),p(f(lt,g(Z,")")),t);case"[":return nt(),p(b(),t);case"{":return nt(),p(P(),t)}J()}if(rt("keyword","function"))return nt(),p(at(!1),t);if(u(G,st.token.type)){var e="regexp"==st.token.type?Y("regexp",st.token.value[0],st.token.value[1]):Y(st.token.type,st.token.value);return p(f(e,nt),t)}J()}),lt=N(function(t,e){0==arguments.length&&(t=!0);var n=r(e);return t&&rt("punc",",")?(nt(),Y("seq",n,lt(!0,e))):n});return Y("toplevel",function(t){for(;!rt("eof");)t.push(ot());return t}([]))}function _(t,e,n){this.name=t,this.start=e,this.end=n}function m(t){function e(t){if(t)return a();m(),w();var e=L();return e?C(e)?g():'"'==e||"'"==e?c():u(N,e)?v("punc",T()):"."==e?r():"/"==e?s():u(I,e)?o():"\\"==e||b(e)?i():void p("Unexpected character '"+e+"'"):v("eof")}function n(t,e){try{return e()}catch(n){if(n!==H)throw n;p(t)}}function i(){var t=_(P);return u(M,t)?u(A,t)?v("operator",t):u(O,t)?v("atom",t):v("keyword",t):v("name",t)}function r(){return T(),C(L())?g("."):v("punc",".")}function s(){T();var t=B.regex_allowed;switch(L()){case"/":return B.comments_before.push(l()),B.regex_allowed=t,e();case"*":return B.comments_before.push(h()),B.regex_allowed=t,e()}return B.regex_allowed?a():o("/")}function o(t){function e(t){if(!L())return t;var n=t+L();return u(A,n)?(T(),e(n)):t}return v("operator",e(t||T()))}function a(){return n("Unterminated regular expression",function(){for(var t,e=!1,n="",i=!1;t=T(!0);)if(e)n+="\\"+t,e=!1;else if("["==t)i=!0,n+=t;else if("]"==t&&i)i=!1,n+=t;else{if("/"==t&&!i)break;"\\"==t?e=!0:n+=t}var r=_(function(t){return u(F,t)});return v("regexp",[n,r])})}function h(){return T(),n("Unterminated multiline comment",function(){var t=E("*/",!0),e=B.text.substring(B.pos,t),n=v("comment2",e,!0);return B.pos=t+2,B.line+=e.split("\n").length-1,B.newline_before=e.indexOf("\n")>=0,n})}function l(){T();var t,e=E("\n");return-1==e?(t=B.text.substr(B.pos),B.pos=B.text.length):(t=B.text.substring(B.pos,e),B.pos=e),v("comment1",t,!0)}function c(){return n("Unterminated string constant",function(){for(var t=T(),e="";;){var n=T(!0);if("\\"==n)n=f();else if(n==t)break;e+=n}return v("string",e)})}function d(t){for(var e=0;t>0;--t){var n=parseInt(T(!0),16);isNaN(n)&&p("Invalid hex-character pattern in string"),e=e<<4|n}return e}function f(){var t=T(!0);switch(t){case"n":return"\n";case"r":return"\r";case"t":return"	";case"b":return"\b";case"v":return"\x0B";case"f":return"\f";case"0":return"\x00";case"x":return String.fromCharCode(d(2));case"u":return String.fromCharCode(d(4));case"\n":return"";default:return t}}function g(t){var e=!1,n=!1,i=!1,r="."==t,s=_(function(s,o){return"x"==s||"X"==s?i?!1:i=!0:i||"E"!=s&&"e"!=s?"-"==s?n||0==o&&!t?!0:!1:"+"==s?n:(n=!1,"."==s?r||i?!1:r=!0:S(s)):e?!1:e=n=!0});t&&(s=t+s);var o=x(s);return isNaN(o)?void p("Invalid syntax: "+s):v("num",o)}function p(t){y(t,B.tokline,B.tokcol,B.tokpos)}function _(t){for(var e="",n=L(),i=0;n&&t(n,i++);)e+=T(),n=L();return e}function m(){for(;u(D,L());)T()}function v(t,e,n){B.regex_allowed="operator"==t&&!u(j,e)||"keyword"==t&&u(k,e)||"punc"==t&&u(R,e);var i={type:t,value:e,line:B.tokline,col:B.tokcol,pos:B.tokpos,nlb:B.newline_before};return n||(i.comments_before=B.comments_before,B.comments_before=[]),B.newline_before=!1,i}function w(){B.tokline=B.line,B.tokcol=B.col,B.tokpos=B.pos}function E(t,e){var n=B.text.indexOf(t,B.pos);if(e&&-1==n)throw H;return n}function T(t){var e=B.text.charAt(B.pos++);if(t&&!e)throw H;return"\n"==e?(B.newline_before=!0,++B.line,B.col=0):++B.col,e}function L(){return B.text.charAt(B.pos)}var B={text:t.replace(/\r\n?|[\n\u2028\u2029]/g,"\n").replace(/^\uFEFF/,""),pos:0,tokpos:0,line:0,tokline:0,col:0,tokcol:0,newline_before:!1,regex_allowed:!1,comments_before:[]};return e.context=function(t){return t&&(B=t),B},e}function v(t,e,n){return t.type==e&&(null==n||t.value==n)}function y(t,e,n,i){throw new w(t,e,n,i)}function w(t,e,n,i){this.message=t,this.line=e,this.col=n,this.pos=i}function x(t){return L.test(t)?parseInt(t.substr(2),16):B.test(t)?parseInt(t.substr(1),8):z.test(t)?parseFloat(t):void 0}function P(t){return b(t)||C(t)}function b(t){return"$"==t||"_"==t||E(t)}function S(t){return C(t)||E(t)}function C(t){return t=t.charCodeAt(0),t>=48&&57>=t}function E(t){return t=t.charCodeAt(0),t>=65&&90>=t||t>=97&&122>=t}var M=d(["break","case","catch","const","continue","default","delete","do","else","finally","for","function","if","in","instanceof","new","return","switch","throw","try","typeof","var","void","while","with"]),T=d(["abstract","boolean","byte","char","class","debugger","double","enum","export","extends","final","float","goto","implements","import","int","interface","long","native","package","private","protected","public","short","static","super","synchronized","throws","transient","volatile"]),k=d(["return","new","delete","throw","else","case"]),O=d(["false","null","true","undefined"]),I=d(l("+-*&%=<>!?|~^")),L=/^0x[0-9a-f]+$/i,B=/^0[0-7]+$/,z=/^\d*\.?\d*(?:e[+-]?\d*(?:\d\.?|\.?\d)\d*)?$/i,A=d(["in","instanceof","typeof","new","void","delete","++","--","+","-","!","~","&","|","^","*","/","%",">>","<<",">>>","<",">","<=",">=","==","===","!=","!==","?","=","+=","-=","/=","*=","%=",">>=","<<=",">>>=","|=","^=","&=","&&","||"]),D=d(l(" \n\r	")),R=d(l("[{}(,.;:")),N=d(l("[]{}(),;:")),F=d(l("gmsiy"));w.prototype.toString=function(){return this.message+" (line: "+this.line+", col: "+this.col+", pos: "+this.pos+")"};var H={},V=d(["typeof","void","delete","--","++","!","~","-","+"]),j=d(["--","++"]),q=function(t,e,n){for(;n<t.length;)e[t[n]]=t[n].substr(0,t[n].length-1),n++;return e}(["+=","-=","/=","*=","%=",">>=","<<=",">>>=","|=","^=","&="],{"=":!0},0),W=function(t,e){for(var n=0,i=1;n<t.length;++n,++i)for(var r=t[n],s=0;s<r.length;++s)e[r[s]]=i;return e}([["||"],["&&"],["|"],["^"],["&"],["==","===","!=","!=="],["<",">","<=",">=","in","instanceof"],[">>","<<",">>>"],["+","-"],["*","/","%"]],{}),U=d(["for","do","while","switch"]),G=d(["atom","num","string","regexp","name"]);_.prototype.toString=function(){return this.name};var Y=d(["name","array","object","string","dot","sub","call","regexp"]),$=d(["if","while","do","for","for-in","with"]);return{parse:p,gen_code:r,tokenizer:m,ast_walker:a}},operators={"+":"add","-":"subtract","*":"multiply","/":"divide","%":"modulo","==":"equals","!=":"equals"},signOperators={"-":"negate"};return DomEvent.add(window,{load:load}),{compile:compile,evaluate:evaluate,load:load,getAttribute:handleAttribute("get"),hasAttribute:handleAttribute("has")}};return this.load=PaperScript.load,Base.each(this,function(t,e){t&&t.prototype instanceof Base&&(t._name=e)}),this.enumerable=!0,new(PaperScope.inject(this))},TWEEN=TWEEN||function(){var t,e,n,i=60,r=!1,s=[];return{setFPS:function(t){i=t||60},stop:function(){clearInterval(e)},setAutostart:function(t){r=t,r&&!e&&this.start()},add:function(t){s.push(t),r&&!e&&this.start()},getAll:function(){return s},removeAll:function(){s=[]},remove:function(e){t=s.indexOf(e),-1!==t&&s.splice(t,1)},update:function(e){for(t=0,n=s.length;n>t;)s[t].update(e||Date.now())?t++:(s.splice(t,1),n--);0==n&&r&&this.stop()}}}();TWEEN.Tween=function(t){var e=t,n={},i={},r={},s=1e3,o=0,a=null,u=TWEEN.Easing.Linear.EaseNone,h=null,l=null,c=null;this.to=function(t,n){null!==n&&(s=n);for(var i in t)null!==e[i]&&(r[i]=t[i]);return this},this.start=function(t){TWEEN.add(this),a=t?t+o:Date.now()+o;for(var s in r)null!==e[s]&&(n[s]=e[s],i[s]=r[s]-e[s]);return this},this.stop=function(){return TWEEN.remove(this),this},this.delay=function(t){return o=t,this},this.easing=function(t){return u=t,this},this.chain=function(t){h=t},this.onUpdate=function(t){return l=t,this},this.onComplete=function(t){return c=t,this},this.update=function(t){var r,o,d;if(a>t)return!0;o=(t-a)/s,o=o>1?1:o,d=u(o);for(r in i)e[r]=n[r]+i[r]*d;return null!==l&&l.call(e,d),1==o?(null!==c&&c.call(e),null!==h&&h.start(),!1):!0}},TWEEN.Easing={Linear:{},Quadratic:{},Cubic:{},Quartic:{},Quintic:{},Sinusoidal:{},Exponential:{},Circular:{},Elastic:{},Back:{},Bounce:{}},TWEEN.Easing.Linear.EaseNone=function(t){return t},TWEEN.Easing.Quadratic.EaseIn=function(t){return t*t},TWEEN.Easing.Quadratic.EaseOut=function(t){return-t*(t-2)},TWEEN.Easing.Quadratic.EaseInOut=function(t){return(t*=2)<1?.5*t*t:-.5*(--t*(t-2)-1)},TWEEN.Easing.Cubic.EaseIn=function(t){return t*t*t},TWEEN.Easing.Cubic.EaseOut=function(t){return--t*t*t+1},TWEEN.Easing.Cubic.EaseInOut=function(t){return(t*=2)<1?.5*t*t*t:.5*((t-=2)*t*t+2)},TWEEN.Easing.Quartic.EaseIn=function(t){return t*t*t*t},TWEEN.Easing.Quartic.EaseOut=function(t){return-(--t*t*t*t-1)},TWEEN.Easing.Quartic.EaseInOut=function(t){return(t*=2)<1?.5*t*t*t*t:-.5*((t-=2)*t*t*t-2)},TWEEN.Easing.Quintic.EaseIn=function(t){return t*t*t*t*t},TWEEN.Easing.Quintic.EaseOut=function(t){return(t-=1)*t*t*t*t+1},TWEEN.Easing.Quintic.EaseInOut=function(t){return(t*=2)<1?.5*t*t*t*t*t:.5*((t-=2)*t*t*t*t+2)},TWEEN.Easing.Sinusoidal.EaseIn=function(t){return-Math.cos(t*Math.PI/2)+1},TWEEN.Easing.Sinusoidal.EaseOut=function(t){return Math.sin(t*Math.PI/2)},TWEEN.Easing.Sinusoidal.EaseInOut=function(t){return-.5*(Math.cos(Math.PI*t)-1)},TWEEN.Easing.Exponential.EaseIn=function(t){return 0==t?0:Math.pow(2,10*(t-1))},TWEEN.Easing.Exponential.EaseOut=function(t){return 1==t?1:-Math.pow(2,-10*t)+1},TWEEN.Easing.Exponential.EaseInOut=function(t){return 0==t?0:t>=1?1:(t*=2)<1?.5*Math.pow(2,10*(t-1)):.5*(-Math.pow(2,-10*(t-1))+2)},TWEEN.Easing.Circular.EaseIn=function(t){return-(Math.sqrt(1-t*t)-1)},TWEEN.Easing.Circular.EaseOut=function(t){return Math.sqrt(1- --t*t)},TWEEN.Easing.Circular.EaseInOut=function(t){return(t/=.5)<1?-.5*(Math.sqrt(1-t*t)-1):.5*(Math.sqrt(1-(t-=2)*t)+1)},TWEEN.Easing.Elastic.EaseIn=function(t){var e,n=.1,i=.4;return 0==t?0:1==t?1:(i||(i=.3),!n||1>n?(n=1,e=i/4):e=i/(2*Math.PI)*Math.asin(1/n),-(n*Math.pow(2,10*(t-=1))*Math.sin((t-e)*(2*Math.PI)/i)))},TWEEN.Easing.Elastic.EaseOut=function(t){var e,n=.1,i=.4;return 0==t?0:1==t?1:(i||(i=.3),!n||1>n?(n=1,e=i/4):e=i/(2*Math.PI)*Math.asin(1/n),n*Math.pow(2,-10*t)*Math.sin((t-e)*(2*Math.PI)/i)+1)},TWEEN.Easing.Elastic.EaseInOut=function(t){var e,n=.1,i=.4;return 0==t?0:1==t?1:(i||(i=.3),!n||1>n?(n=1,e=i/4):e=i/(2*Math.PI)*Math.asin(1/n),(t*=2)<1?-.5*(n*Math.pow(2,10*(t-=1))*Math.sin((t-e)*(2*Math.PI)/i)):n*Math.pow(2,-10*(t-=1))*Math.sin((t-e)*(2*Math.PI)/i)*.5+1)},TWEEN.Easing.Back.EaseIn=function(t){var e=1.70158;return t*t*((e+1)*t-e)},TWEEN.Easing.Back.EaseOut=function(t){var e=1.70158;return(t-=1)*t*((e+1)*t+e)+1},TWEEN.Easing.Back.EaseInOut=function(t){var e=2.5949095;return(t*=2)<1?.5*(t*t*((e+1)*t-e)):.5*((t-=2)*t*((e+1)*t+e)+2)},TWEEN.Easing.Bounce.EaseIn=function(t){return 1-TWEEN.Easing.Bounce.EaseOut(1-t)},TWEEN.Easing.Bounce.EaseOut=function(t){return(t/=1)<1/2.75?7.5625*t*t:2/2.75>t?7.5625*(t-=1.5/2.75)*t+.75:2.5/2.75>t?7.5625*(t-=2.25/2.75)*t+.9375:7.5625*(t-=2.625/2.75)*t+.984375},TWEEN.Easing.Bounce.EaseInOut=function(t){return.5>t?.5*TWEEN.Easing.Bounce.EaseIn(2*t):.5*TWEEN.Easing.Bounce.EaseOut(2*t-1)+.5},Vector.prototype.set=function(){var t=arguments.length;3===t?(this.x=arguments[0],this.y=arguments[1],this.z=arguments[2]):1===t&&(this.x=arguments[0].x,this.y=arguments[0].y,this.z=arguments[0].z)},Vector.prototype.add=function(t){var e=arguments.length;3===e?(this.x+=arguments[0],this.y+=arguments[1],this.z+=arguments[2]):1===e&&(this.x+=arguments[0].x,this.y+=arguments[0].y,this.z+=arguments[0].z)},Vector.prototype.substract=function(t){var e=arguments.length;3===e?(this.x-=arguments[0],this.y-=arguments[1],this.z-=arguments[2]):1===e&&(this.x-=arguments[0].x,this.y-=arguments[0].y,this.z-=arguments[0].z)},Vector.prototype.scale=function(t){this.x*=t,this.y*=t,this.z*=t},Vector.prototype.distanceTo=function(){var t=arguments.length;if(3===t){var e=this.x-arguments[0],n=this.y-arguments[1],i=this.z-arguments[2];return Math.sqrt(e*e+n*n+i*i)}return 1===t?Math.sqrt(this.distanceSquaredTo(arguments[0])):void 0},Vector.prototype.distanceSquaredTo=function(t){var e=this.x-t.x,n=this.y-t.y,i=this.z-t.z;return e*e+n*n+i*i},Vector.prototype.dot=function(t){return this.x*t.x+this.y*t.y+this.z*t.z},Vector.prototype.length=function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)},Vector.prototype.lengthSquared=function(){return this.x*this.x+this.y*this.y+this.z*this.z},Vector.prototype.clear=function(){this.x=0,this.y=0,this.z=0},Vector.prototype.toString=function(){return"("+this.x+","+this.y+","+this.z+")"},Vector.prototype.cross=function(t){return new Vector(this.y*t.z-this.z*t.y,this.x*t.z-this.z*t.x,this.x*t.y-this.y*t.x)},Vector.prototype.isZero=function(){return 0===this.x&&0===this.y&&0===this.z},Particle.prototype.distanceTo=function(t){return this.position.distanceTo(t.position)},Particle.prototype.makeFixed=function(){this.fixed=!0,this.velocity.clear()},Particle.prototype.reset=function(){this.age=0,this.dead=!1,this.position.clear(),this.velocity.clear(),this.force.clear(),this.mass=1},Spring.prototype.currentLength=function(){return this.a.position.distanceTo(this.b.position)},Spring.prototype.apply=function(){var t=this.a,e=this.b;if(!(!this.on||t.fixed&&e.fixed)){var n=t.position.x-e.position.x,i=t.position.y-e.position.y,r=t.position.z-e.position.z,s=Math.sqrt(n*n+i*i+r*r);0===s?(n=0,i=0,r=0):(n/=s,i/=s,r/=s);var o=-1*(s-this.length)*this.constant,a=t.velocity.x-e.velocity.x,u=t.velocity.y-e.velocity.y,h=t.velocity.z-e.velocity.z,l=-1*this.damping*(n*a+i*u+r*h),c=o+l;n*=c,i*=c,r*=c,t.fixed||t.force.add(n,i,r),e.fixed||e.force.add(-1*n,-1*i,-1*r)}},Attraction.prototype.apply=function(){var t=this.a,e=this.b;if(!(!this.on||t.fixed&&e.fixed)){var n=t.position.x-e.position.x,i=t.position.y-e.position.y,r=t.position.z-e.position.z,s=Math.max(n*n+i*i+r*r,this.distanceMinSquared),o=this.constant*t.mass*e.mass/s,a=Math.sqrt(s);0===o||0===a?(n=0,i=0,r=0):(n/=a,i/=a,r/=a,n*=o,i*=o,r*=o),t.fixed||t.force.add(-n,-i,-r),e.fixed||e.force.add(n,i,r)}},RungeKuttaIntegrator.prototype.allocateParticles=function(){for(;this.s.particles.length>this.originalPositions.length;)this.originalPositions.push(new Vector),this.originalVelocities.push(new Vector),this.k1Forces.push(new Vector),this.k1Velocities.push(new Vector),this.k2Forces.push(new Vector),this.k2Velocities.push(new Vector),this.k3Forces.push(new Vector),this.k3Velocities.push(new Vector),this.k4Forces.push(new Vector),this.k4Velocities.push(new Vector)},RungeKuttaIntegrator.prototype.step=function(t){var e,n,i,r,s,o,a,u,h,l,c,d,f=this.s;for(this.allocateParticles(),n=0;n<f.particles.length;n++)e=f.particles[n],e.fixed||(this.originalPositions[n].set(e.position),this.originalVelocities[n].set(e.velocity)),e.force.clear();for(f.applyForces(),n=0;n<f.particles.length;n++)e=f.particles[n],e.fixed||(this.k1Forces[n].set(e.force),this.k1Velocities[n].set(e.velocity)),e.force.clear();for(n=0;n<f.particles.length;n++)e=f.particles[n],e.fixed||(i=this.originalPositions[n],s=this.k1Velocities[n],e.position.x=i.x+.5*s.x*t,e.position.y=i.y+.5*s.y*t,e.position.z=i.z+.5*s.z*t,r=this.originalVelocities[n],h=this.k1Forces[n],e.velocity.x=r.x+.5*h.x*t/e.mass,e.velocity.y=r.y+.5*h.y*t/e.mass,e.velocity.z=r.z+.5*h.z*t/e.mass);for(f.applyForces(),n=0;n<f.particles.length;n++)e=f.particles[n],e.fixed||(this.k2Forces[n].set(e.force),this.k2Velocities[n].set(e.velocity)),e.force.clear();for(n=0;n<f.particles.length;n++)e=f.particles[n],e.fixed||(i=this.originalPositions[n],o=this.k2Velocities[n],e.position.x=i.x+.5*o.x*t,e.position.y=i.y+.5*o.y*t,e.position.z=i.z+.5*o.z*t,r=this.originalVelocities[n],l=this.k2Forces[n],e.velocity.x=r.x+.5*l.x*t/e.mass,e.velocity.y=r.y+.5*l.y*t/e.mass,e.velocity.z=r.z+.5*l.z*t/e.mass);for(f.applyForces(),n=0;n<f.particles.length;n++)e=f.particles[n],e.fixed||(this.k3Forces[n].set(e.force),this.k3Velocities[n].set(e.velocity)),e.force.clear();for(n=0;n<f.particles.length;n++)e=f.particles[n],e.fixed||(i=this.originalPositions[n],a=this.k3Velocities[n],e.position.x=i.x+a.x*t,e.position.y=i.y+a.y*t,e.position.z=i.z+a.z*t,r=this.originalVelocities[n],c=this.k3Forces[n],e.velocity.x=r.x+c.x*t/e.mass,e.velocity.y=r.y+c.y*t/e.mass,e.velocity.z=r.z+c.z*t/e.mass);for(f.applyForces(),n=0;n<f.particles.length;n++)e=f.particles[n],e.fixed||(this.k4Forces[n].set(e.force),this.k4Velocities[n].set(e.velocity));for(n=0;n<f.particles.length;n++)e=f.particles[n],e.age+=t,e.fixed||(i=this.originalPositions[n],s=this.k1Velocities[n],o=this.k2Velocities[n],a=this.k3Velocities[n],u=this.k4Velocities[n],e.position.x=i.x+t/6*(s.x+2*o.x+2*a.x+u.x),e.position.y=i.y+t/6*(s.y+2*o.y+2*a.y+u.y),e.position.z=i.z+t/6*(s.z+2*o.z+2*a.z+u.z),r=this.originalVelocities[n],h=this.k1Forces[n],l=this.k2Forces[n],c=this.k3Forces[n],d=this.k4Forces[n],e.velocity.x=r.x+t/(6*e.mass)*(h.x+2*l.x+2*c.x+d.x),e.velocity.y=r.y+t/(6*e.mass)*(h.y+2*l.y+2*c.y+d.y),e.velocity.z=r.z+t/(6*e.mass)*(h.z+2*l.z+2*c.z+d.z))},ParticleSystem.DEFAULT_GRAVITY=0,ParticleSystem.DEFAULT_DRAG=.001,ParticleSystem.prototype.setGravity=function(){var t=arguments.length;1===t?this.gravity.set(0,arguments[0],0):3===t&&this.gravity.set(arguments[0],arguments[1],arguments[2])},ParticleSystem.prototype.tick=function(){this.integrator.step(0===arguments.length?1:arguments[0])},ParticleSystem.prototype.makeParticle=function(){var t=1,e=0,n=0,i=0;4===arguments.length&&(t=arguments[0],e=arguments[1],n=arguments[2],i=arguments[3]);var r=new Particle(t);return r.position.set(e,n,i),this.particles.push(r),r},ParticleSystem.prototype.makeSpring=function(t,e,n,i,r){var s=new Spring(t,e,n,i,r);return this.springs.push(s),s},ParticleSystem.prototype.makeAttraction=function(t,e,n,i){var r=new Attraction(t,e,n,i);return this.attractions.push(r),r},ParticleSystem.prototype.clear=function(){this.particles.clear(),this.springs.clear(),this.attractions.clear()},ParticleSystem.prototype.applyForces=function(){var t,e;if(!this.gravity.isZero())for(e=0;e<this.particles.length;e++)t=this.particles[e],t.force.add(this.gravity);   for(e=0;e<this.particles.length;e++)t=this.particles[e],t.force.add(-1*t.velocity.x*this.drag,-1*t.velocity.y*this.drag,-1*t.velocity.z*this.drag);for(e=0;e<this.springs.length;e++)t=this.springs[e],t.apply();for(e=0;e<this.attractions.length;e++)t=this.attractions[e],t.apply();for(e=0;e<this.forces.length;e++)t=this.forces[e],t.apply()},ParticleSystem.prototype.clearForces=function(){var t;for(t=0;t<this.particles.length;t++)this.particles[t].clear()},Array.prototype.remove=function(t){var e;if("number"==typeof t)this.splice(t,1);else for(e=0;e<this.length;e++)this[e]===t&&(this.remove(e),e--)},function(t){function e(e,n){function i(t){return ot.preferFlash&&et&&!ot.ignoreFlash&&"undefined"!=typeof ot.flash[t]&&ot.flash[t]}function r(t){return function(e){var n=this._t;return n&&n._a?t.call(this,e):null}}this.setupOptions={url:e||null,flashVersion:8,debugMode:!0,debugFlash:!1,useConsole:!0,consoleOnly:!0,waitForWindowLoad:!1,bgColor:"#ffffff",useHighPerformance:!1,flashPollingInterval:null,html5PollingInterval:null,flashLoadTimeout:1e3,wmode:null,allowScriptAccess:"always",useFlashBlock:!1,useHTML5Audio:!0,html5Test:/^(probably|maybe)$/i,preferFlash:!0,noSWFCache:!1},this.defaultOptions={autoLoad:!1,autoPlay:!1,from:null,loops:1,onid3:null,onload:null,whileloading:null,onplay:null,onpause:null,onresume:null,whileplaying:null,onposition:null,onstop:null,onfailure:null,onfinish:null,multiShot:!0,multiShotEvents:!1,position:null,pan:0,stream:!0,to:null,type:null,usePolicyFile:!1,volume:100},this.flash9Options={isMovieStar:null,usePeakData:!1,useWaveformData:!1,useEQData:!1,onbufferchange:null,ondataerror:null},this.movieStarOptions={bufferTime:3,serverURL:null,onconnect:null,duration:null},this.audioFormats={mp3:{type:['audio/mpeg; codecs="mp3"',"audio/mpeg","audio/mp3","audio/MPA","audio/mpa-robust"],required:!0},mp4:{related:["aac","m4a"],type:['audio/mp4; codecs="mp4a.40.2"',"audio/aac","audio/x-m4a","audio/MP4A-LATM","audio/mpeg4-generic"],required:!1},ogg:{type:["audio/ogg; codecs=vorbis"],required:!1},wav:{type:['audio/wav; codecs="1"',"audio/wav","audio/wave","audio/x-wav"],required:!1}},this.movieID="sm2-container",this.id=n||"sm2movie",this.debugID="soundmanager-debug",this.debugURLParam=/([#?&])debug=1/i,this.versionNumber="V2.97a.20120624",this.altURL=this.movieURL=this.version=null,this.enabled=this.swfLoaded=!1,this.oMC=null,this.sounds={},this.soundIDs=[],this.didFlashBlock=this.muted=!1,this.filePattern=null,this.filePatterns={flash8:/\.mp3(\?.*)?$/i,flash9:/\.mp3(\?.*)?$/i},this.features={buffering:!1,peakData:!1,waveformData:!1,eqData:!1,movieStar:!1},this.sandbox={};var s;try{s="undefined"!=typeof Audio&&"undefined"!=typeof(new Audio).canPlayType}catch(o){s=!1}this.hasHTML5=s,this.html5={usingFlash:null},this.flash={},this.ignoreFlash=this.html5Only=!1;var a,u,h,l,c,d,f,g,p,_,m,v,y,w,x,P,b,S,C,E,M,T,k,O,I,L,B,z,A,D,R,N,F,H,V,j,q,W,U,G,Y,$,X,Z,K,J,Q,tt,et,nt,it,rt,st,ot=this,at=null,ut=navigator.userAgent,ht=t,lt=ht.location.href.toString(),ct=document,dt=[],ft=!1,gt=!1,pt=!1,_t=!1,mt=!1,vt=null,yt=null,wt=!1,xt=!1,Pt=0,bt=null,St=null,Ct=Array.prototype.slice,Et=!1,Mt=ut.match(/(ipad|iphone|ipod)/i),Tt=ut.match(/msie/i),kt=ut.match(/webkit/i),Ot=ut.match(/safari/i)&&!ut.match(/chrome/i),It=ut.match(/opera/i),Lt=ut.match(/(mobile|pre\/|xoom)/i)||Mt,Bt=!lt.match(/usehtml5audio/i)&&!lt.match(/sm2\-ignorebadua/i)&&Ot&&!ut.match(/silk/i)&&ut.match(/OS X 10_6_([3-7])/i),zt="undefined"!=typeof ct.hasFocus?ct.hasFocus():null,At=Ot&&("undefined"==typeof ct.hasFocus||!ct.hasFocus()),Dt=!At,Rt=/(mp3|mp4|mpa|m4a)/i,Nt=ct.location?ct.location.protocol.match(/http/i):null,Ft=Nt?"":"http://",Ht=/^\s*audio\/(?:x-)?(?:mpeg4|aac|flv|mov|mp4||m4v|m4a|mp4v|3gp|3g2)\s*(?:$|;)/i,Vt="mpeg4,aac,flv,mov,mp4,m4v,f4v,m4a,mp4v,3gp,3g2".split(","),jt=RegExp("\\.("+Vt.join("|")+")(\\?.*)?$","i");this.mimePattern=/^\s*audio\/(?:x-)?(?:mp(?:eg|3))\s*(?:$|;)/i,this.useAltURL=!Nt,this._global_a=null,Lt&&(ot.useHTML5Audio=!0,ot.preferFlash=!1,Mt)&&(Et=ot.ignoreFlash=!0),this.setup=function(t){return"undefined"!=typeof t&&pt&&St&&ot.ok()&&("undefined"!=typeof t.flashVersion||"undefined"!=typeof t.url)&&V(D("setupLate")),p(t),ot},this.supported=this.ok=function(){return St?pt&&!_t:ot.useHTML5Audio&&ot.hasHTML5},this.getMovie=function(t){return u(t)||ct[t]||ht[t]},this.createSound=function(t,e){function n(){return i=F(i),ot.sounds[s.id]=new a(s),ot.soundIDs.push(s.id),ot.sounds[s.id]}var i=null,r=null,s=null;return pt&&ot.ok()?("undefined"!=typeof e&&(t={id:t,url:e}),i=g(t),i.url=G(i.url),s=i,j(s.id,!0)?ot.sounds[s.id]:($(s)?(r=n(),r._setup_html5(s)):(d>8&&null===s.isMovieStar&&(s.isMovieStar=!(!s.serverURL&&!(s.type&&s.type.match(Ht)||s.url.match(jt)))),s=H(s,void 0),r=n(),8===d?at._createSound(s.id,s.loops||1,s.usePolicyFile):(at._createSound(s.id,s.url,s.usePeakData,s.useWaveformData,s.useEQData,s.isMovieStar,s.isMovieStar?s.bufferTime:!1,s.loops||1,s.serverURL,s.duration||null,s.autoPlay,!0,s.autoLoad,s.usePolicyFile),s.serverURL||(r.connected=!0,s.onconnect&&s.onconnect.apply(r))),!s.serverURL&&(s.autoLoad||s.autoPlay)&&r.load(s)),!s.serverURL&&s.autoPlay&&r.play(),r)):(V(void 0),!1)},this.destroySound=function(t,e){if(!j(t))return!1;var n,i=ot.sounds[t];for(i._iO={},i.stop(),i.unload(),n=0;n<ot.soundIDs.length;n++)if(ot.soundIDs[n]===t){ot.soundIDs.splice(n,1);break}return e||i.destruct(!0),delete ot.sounds[t],!0},this.load=function(t,e){return j(t)?ot.sounds[t].load(e):!1},this.unload=function(t){return j(t)?ot.sounds[t].unload():!1},this.onposition=this.onPosition=function(t,e,n,i){return j(t)?ot.sounds[t].onposition(e,n,i):!1},this.clearOnPosition=function(t,e,n){return j(t)?ot.sounds[t].clearOnPosition(e,n):!1},this.start=this.play=function(t,e){var n=!1;return pt&&ot.ok()?j(t)?ot.sounds[t].play(e):(e instanceof Object||(e={url:e}),e&&e.url&&(e.id=t,n=ot.createSound(e).play()),n):(V("soundManager.play(): "+D(pt?"notOK":"notReady")),n)},this.setPosition=function(t,e){return j(t)?ot.sounds[t].setPosition(e):!1},this.stop=function(t){return j(t)?ot.sounds[t].stop():!1},this.stopAll=function(){for(var t in ot.sounds)ot.sounds.hasOwnProperty(t)&&ot.sounds[t].stop()},this.pause=function(t){return j(t)?ot.sounds[t].pause():!1},this.pauseAll=function(){var t;for(t=ot.soundIDs.length-1;t>=0;t--)ot.sounds[ot.soundIDs[t]].pause()},this.resume=function(t){return j(t)?ot.sounds[t].resume():!1},this.resumeAll=function(){var t;for(t=ot.soundIDs.length-1;t>=0;t--)ot.sounds[ot.soundIDs[t]].resume()},this.togglePause=function(t){return j(t)?ot.sounds[t].togglePause():!1},this.setPan=function(t,e){return j(t)?ot.sounds[t].setPan(e):!1},this.setVolume=function(t,e){return j(t)?ot.sounds[t].setVolume(e):!1},this.mute=function(t){var e=0;if("string"!=typeof t&&(t=null),t)return j(t)?ot.sounds[t].mute():!1;for(e=ot.soundIDs.length-1;e>=0;e--)ot.sounds[ot.soundIDs[e]].mute();return ot.muted=!0},this.muteAll=function(){ot.mute()},this.unmute=function(t){if("string"!=typeof t&&(t=null),t)return j(t)?ot.sounds[t].unmute():!1;for(t=ot.soundIDs.length-1;t>=0;t--)ot.sounds[ot.soundIDs[t]].unmute();return ot.muted=!1,!0},this.unmuteAll=function(){ot.unmute()},this.toggleMute=function(t){return j(t)?ot.sounds[t].toggleMute():!1},this.getMemoryUse=function(){var t=0;return at&&8!==d&&(t=parseInt(at._getMemoryUse(),10)),t},this.disable=function(t){var e;if("undefined"==typeof t&&(t=!1),_t)return!1;for(_t=!0,e=ot.soundIDs.length-1;e>=0;e--)B(ot.sounds[ot.soundIDs[e]]);return f(t),tt.remove(ht,"load",y),!0},this.canPlayMIME=function(t){var e;return ot.hasHTML5&&(e=X({type:t})),!e&&St&&(e=t&&ot.ok()?!!(d>8&&t.match(Ht)||t.match(ot.mimePattern)):null),e},this.canPlayURL=function(t){var e;return ot.hasHTML5&&(e=X({url:t})),!e&&St&&(e=t&&ot.ok()?!!t.match(ot.filePattern):null),e},this.canPlayLink=function(t){return"undefined"!=typeof t.type&&t.type&&ot.canPlayMIME(t.type)?!0:ot.canPlayURL(t.href)},this.getSoundById=function(t){if(!t)throw Error("soundManager.getSoundById(): sID is null/undefined");return ot.sounds[t]},this.onready=function(t,e){if("function"!=typeof t)throw D("needFunction","onready");return e||(e=ht),m("onready",t,e),v(),!0},this.ontimeout=function(t,e){if("function"!=typeof t)throw D("needFunction","ontimeout");return e||(e=ht),m("ontimeout",t,e),v({type:"ontimeout"}),!0},this._wD=this._writeDebug=function(){return!0},this._debug=function(){},this.reboot=function(){var t,e;for(t=ot.soundIDs.length-1;t>=0;t--)ot.sounds[ot.soundIDs[t]].destruct();if(at)try{Tt&&(yt=at.innerHTML),vt=at.parentNode.removeChild(at)}catch(n){}yt=vt=St=null,ot.enabled=M=pt=wt=xt=ft=gt=_t=ot.swfLoaded=!1,ot.soundIDs=[],ot.sounds={},at=null;for(t in dt)if(dt.hasOwnProperty(t))for(e=dt[t].length-1;e>=0;e--)dt[t][e].fired=!1;ht.setTimeout(ot.beginDelayedInit,20)},this.getMoviePercent=function(){return at&&"undefined"!=typeof at.PercentLoaded?at.PercentLoaded():null},this.beginDelayedInit=function(){mt=!0,C(),setTimeout(function(){return xt?!1:(k(),S(),xt=!0)},20),w()},this.destruct=function(){ot.disable(!0)},a=function(t){var e,n,i,r,s,o,a,u,h,l,c=this,f=!1,p=[],_=0,m=null;e=null,n=null,this.sID=this.id=t.id,this.url=t.url,this._iO=this.instanceOptions=this.options=g(t),this.pan=this.options.pan,this.volume=this.options.volume,this.isHTML5=!1,this._a=null,this.id3={},this._debug=function(){},this.load=function(t){var e=null;if("undefined"!=typeof t?(c._iO=g(t,c.options),c.instanceOptions=c._iO):(t=c.options,c._iO=t,c.instanceOptions=c._iO,m&&m!==c.url&&(c._iO.url=c.url,c.url=null)),c._iO.url||(c._iO.url=c.url),c._iO.url=G(c._iO.url),c._iO.url===c.url&&0!==c.readyState&&2!==c.readyState)return 3===c.readyState&&c._iO.onload&&c._iO.onload.apply(c,[!!c.duration]),c;if(t=c._iO,m=c.url,c.loaded=!1,c.readyState=1,c.playState=0,c.id3={},$(t))e=c._setup_html5(t),e._called_load||(c._html5_canplay=!1,c._a.src!==t.url&&(c._a.src=t.url,c.setPosition(0)),c._a.autobuffer="auto",c._a.preload="auto",e._called_load=!0,t.autoPlay&&c.play());else try{c.isHTML5=!1,c._iO=H(F(t)),t=c._iO,8===d?at._load(c.id,t.url,t.stream,t.autoPlay,t.whileloading?1:0,t.loops||1,t.usePolicyFile):at._load(c.id,t.url,!!t.stream,!!t.autoPlay,t.loops||1,!!t.autoLoad,t.usePolicyFile)}catch(n){O({type:"SMSOUND_LOAD_JS_EXCEPTION",fatal:!0})}return c},this.unload=function(){return 0!==c.readyState&&(c.isHTML5?(o(),c._a&&(c._a.pause(),K(c._a,"about:blank"),c.url="about:blank")):8===d?at._unload(c.id,"about:blank"):at._unload(c.id),i()),c},this.destruct=function(t){c.isHTML5?(o(),c._a&&(c._a.pause(),K(c._a),Et||s(),c._a._t=null,c._a=null)):(c._iO.onfailure=null,at._destroySound(c.id)),t||ot.destroySound(c.id,!0)},this.start=this.play=function(t,e){var n,i;if(i=!0,i=null,e="undefined"==typeof e?!0:e,t||(t={}),c._iO=g(t,c._iO),c._iO=g(c._iO,c.options),c._iO.url=G(c._iO.url),c.instanceOptions=c._iO,c._iO.serverURL&&!c.connected)return c.getAutoPlay()||c.setAutoPlay(!0),c;if($(c._iO)&&(c._setup_html5(c._iO),a()),1!==c.playState||c.paused||(n=c._iO.multiShot)||(i=c),null!==i)return i;if(c.loaded||(0===c.readyState?(c.isHTML5||(c._iO.autoPlay=!0),c.load(c._iO)):2===c.readyState&&(i=c)),null!==i)return i;if(!c.isHTML5&&9===d&&0<c.position&&c.position===c.duration&&(t.position=0),c.paused&&c.position&&0<c.position)c.resume();else{if(c._iO=g(t,c._iO),null!==c._iO.from&&null!==c._iO.to&&0===c.instanceCount&&0===c.playState&&!c._iO.serverURL){if(n=function(){c._iO=g(t,c._iO),c.play(c._iO)},c.isHTML5&&!c._html5_canplay?(c.load({_oncanplay:n}),i=!1):c.isHTML5||c.loaded||c.readyState&&2===c.readyState||(c.load({onload:n}),i=!1),null!==i)return i;c._iO=l()}(!c.instanceCount||c._iO.multiShotEvents||!c.isHTML5&&d>8&&!c.getAutoPlay())&&c.instanceCount++,c._iO.onposition&&0===c.playState&&u(c),c.playState=1,c.paused=!1,c.position="undefined"==typeof c._iO.position||isNaN(c._iO.position)?0:c._iO.position,c.isHTML5||(c._iO=H(F(c._iO))),c._iO.onplay&&e&&(c._iO.onplay.apply(c),f=!0),c.setVolume(c._iO.volume,!0),c.setPan(c._iO.pan,!0),c.isHTML5?(a(),i=c._setup_html5(),c.setPosition(c._iO.position),i.play()):(i=at._start(c.id,c._iO.loops||1,9===d?c._iO.position:c._iO.position/1e3,c._iO.multiShot),9===d&&!i&&c._iO.onplayerror&&c._iO.onplayerror.apply(c))}return c},this.stop=function(t){var e=c._iO;return 1===c.playState&&(c._onbufferchange(0),c._resetOnPosition(0),c.paused=!1,c.isHTML5||(c.playState=0),h(),e.to&&c.clearOnPosition(e.to),c.isHTML5?c._a&&(t=c.position,c.setPosition(0),c.position=t,c._a.pause(),c.playState=0,c._onTimer(),o()):(at._stop(c.id,t),e.serverURL&&c.unload()),c.instanceCount=0,c._iO={},e.onstop&&e.onstop.apply(c)),c},this.setAutoPlay=function(t){c._iO.autoPlay=t,c.isHTML5||(at._setAutoPlay(c.id,t),t&&!c.instanceCount&&1===c.readyState&&c.instanceCount++)},this.getAutoPlay=function(){return c._iO.autoPlay},this.setPosition=function(t){"undefined"==typeof t&&(t=0);var e=c.isHTML5?Math.max(t,0):Math.min(c.duration||c._iO.duration,Math.max(t,0));if(c.position=e,t=c.position/1e3,c._resetOnPosition(c.position),c._iO.position=e,c.isHTML5){if(c._a&&c._html5_canplay&&c._a.currentTime!==t)try{c._a.currentTime=t,(0===c.playState||c.paused)&&c._a.pause()}catch(n){}}else t=9===d?c.position:t,c.readyState&&2!==c.readyState&&at._setPosition(c.id,t,c.paused||!c.playState,c._iO.multiShot);return c.isHTML5&&c.paused&&c._onTimer(!0),c},this.pause=function(t){return c.paused||0===c.playState&&1!==c.readyState?c:(c.paused=!0,c.isHTML5?(c._setup_html5().pause(),o()):(t||"undefined"==typeof t)&&at._pause(c.id,c._iO.multiShot),c._iO.onpause&&c._iO.onpause.apply(c),c)},this.resume=function(){var t=c._iO;return c.paused?(c.paused=!1,c.playState=1,c.isHTML5?(c._setup_html5().play(),a()):(t.isMovieStar&&!t.serverURL&&c.setPosition(c.position),at._pause(c.id,t.multiShot)),!f&&t.onplay?(t.onplay.apply(c),f=!0):t.onresume&&t.onresume.apply(c),c):c},this.togglePause=function(){return 0===c.playState?(c.play({position:9!==d||c.isHTML5?c.position/1e3:c.position}),c):(c.paused?c.resume():c.pause(),c)},this.setPan=function(t,e){return"undefined"==typeof t&&(t=0),"undefined"==typeof e&&(e=!1),c.isHTML5||at._setPan(c.id,t),c._iO.pan=t,e||(c.pan=t,c.options.pan=t),c},this.setVolume=function(t,e){return"undefined"==typeof t&&(t=100),"undefined"==typeof e&&(e=!1),c.isHTML5?c._a&&(c._a.volume=Math.max(0,Math.min(1,t/100))):at._setVolume(c.id,ot.muted&&!c.muted||c.muted?0:t),c._iO.volume=t,e||(c.volume=t,c.options.volume=t),c},this.mute=function(){return c.muted=!0,c.isHTML5?c._a&&(c._a.muted=!0):at._setVolume(c.id,0),c},this.unmute=function(){c.muted=!1;var t="undefined"!=typeof c._iO.volume;return c.isHTML5?c._a&&(c._a.muted=!1):at._setVolume(c.id,t?c._iO.volume:c.options.volume),c},this.toggleMute=function(){return c.muted?c.unmute():c.mute()},this.onposition=this.onPosition=function(t,e,n){return p.push({position:parseInt(t,10),method:e,scope:"undefined"!=typeof n?n:c,fired:!1}),c},this.clearOnPosition=function(t,e){var n,t=parseInt(t,10);if(isNaN(t))return!1;for(n=0;n<p.length;n++)t!==p[n].position||e&&e!==p[n].method||(p[n].fired&&_--,p.splice(n,1))},this._processOnPosition=function(){var t,e;if(t=p.length,!t||!c.playState||_>=t)return!1;for(t-=1;t>=0;t--)e=p[t],!e.fired&&c.position>=e.position&&(e.fired=!0,_++,e.method.apply(e.scope,[e.position]));return!0},this._resetOnPosition=function(t){var e,n;if(e=p.length,!e)return!1;for(e-=1;e>=0;e--)n=p[e],n.fired&&t<=n.position&&(n.fired=!1,_--);return!0},l=function(){var t,e,n=c._iO,i=n.from,r=n.to;return e=function(){c.clearOnPosition(r,e),c.stop()},t=function(){null===r||isNaN(r)||c.onPosition(r,e)},null===i||isNaN(i)||(n.position=i,n.multiShot=!1,t()),n},u=function(){var t,e=c._iO.onposition;if(e)for(t in e)e.hasOwnProperty(t)&&c.onPosition(parseInt(t,10),e[t])},h=function(){var t,e=c._iO.onposition;if(e)for(t in e)e.hasOwnProperty(t)&&c.clearOnPosition(parseInt(t,10))},a=function(){c.isHTML5&&q(c)},o=function(){c.isHTML5&&W(c)},i=function(t){t||(p=[],_=0),f=!1,c._hasTimer=null,c._a=null,c._html5_canplay=!1,c.bytesLoaded=null,c.bytesTotal=null,c.duration=c._iO&&c._iO.duration?c._iO.duration:null,c.durationEstimate=null,c.buffered=[],c.eqData=[],c.eqData.left=[],c.eqData.right=[],c.failures=0,c.isBuffering=!1,c.instanceOptions={},c.instanceCount=0,c.loaded=!1,c.metadata={},c.readyState=0,c.muted=!1,c.paused=!1,c.peakData={left:0,right:0},c.waveformData={left:[],right:[]},c.playState=0,c.position=null,c.id3={}},i(),this._onTimer=function(t){var i,r=!1,s={};return c._hasTimer||t?(c._a&&(t||(0<c.playState||1===c.readyState)&&!c.paused)&&(i=c._get_html5_duration(),i!==e&&(e=i,c.duration=i,r=!0),c.durationEstimate=c.duration,i=1e3*c._a.currentTime||0,i!==n&&(n=i,r=!0),(r||t)&&c._whileplaying(i,s,s,s,s)),r):void 0},this._get_html5_duration=function(){var t=c._iO,e=c._a?1e3*c._a.duration:t?t.duration:void 0;return e&&!isNaN(e)&&1/0!==e?e:t?t.duration:null},this._apply_loop=function(t,e){t.loop=e>1?"loop":""},this._setup_html5=function(t){var e,t=g(c._iO,t),n=decodeURI,s=Et?ot._global_a:c._a,o=n(t.url),a=s&&s._t?s._t.instanceOptions:null;if(s){if(s._t&&(Et||o!==n(m)?!Et||a.url!==t.url||m&&m!==a.url||(e=s):e=s,e))return c._apply_loop(s,t.loops),e;Et&&s._t&&s._t.playState&&t.url!==a.url&&s._t.stop(),i(a&&a.url?t.url===a.url:m?m===t.url:!1),s.src=t.url,m=c.url=t.url,s._called_load=!1}else c._a=t.autoLoad||t.autoPlay?new Audio(t.url):It?new Audio(null):new Audio,s=c._a,s._called_load=!1,Et&&(ot._global_a=s);return c.isHTML5=!0,c._a=s,s._t=c,r(),c._apply_loop(s,t.loops),t.autoLoad||t.autoPlay?c.load():(s.autobuffer=!1,s.preload="auto"),s},r=function(){if(c._a._added_events)return!1;var t;c._a._added_events=!0;for(t in rt)rt.hasOwnProperty(t)&&c._a&&c._a.addEventListener(t,rt[t],!1);return!0},s=function(){var t;c._a._added_events=!1;for(t in rt)rt.hasOwnProperty(t)&&c._a&&c._a.removeEventListener(t,rt[t],!1)},this._onload=function(t){return t=!!t||!c.isHTML5&&8===d&&c.duration,c.loaded=t,c.readyState=t?3:2,c._onbufferchange(0),c._iO.onload&&c._iO.onload.apply(c,[t]),!0},this._onbufferchange=function(t){return 0===c.playState||t&&c.isBuffering||!t&&!c.isBuffering?!1:(c.isBuffering=1===t,c._iO.onbufferchange&&c._iO.onbufferchange.apply(c),!0)},this._onsuspend=function(){return c._iO.onsuspend&&c._iO.onsuspend.apply(c),!0},this._onfailure=function(t,e,n){c.failures++,c._iO.onfailure&&1===c.failures&&c._iO.onfailure(c,t,e,n)},this._onfinish=function(){var t=c._iO.onfinish;c._onbufferchange(0),c._resetOnPosition(0),c.instanceCount&&(c.instanceCount--,!c.instanceCount&&(h(),c.playState=0,c.paused=!1,c.instanceCount=0,c.instanceOptions={},c._iO={},o(),c.isHTML5)&&(c.position=0),(!c.instanceCount||c._iO.multiShotEvents)&&t&&t.apply(c))},this._whileloading=function(t,e,n,i){var r=c._iO;c.bytesLoaded=t,c.bytesTotal=e,c.duration=Math.floor(n),c.bufferLength=i,r.isMovieStar?c.durationEstimate=c.duration:(c.durationEstimate=r.duration?c.duration>r.duration?c.duration:r.duration:parseInt(c.bytesTotal/c.bytesLoaded*c.duration,10),"undefined"==typeof c.durationEstimate&&(c.durationEstimate=c.duration)),c.isHTML5||(c.buffered=[{start:0,end:c.duration}]),(3!==c.readyState||c.isHTML5)&&r.whileloading&&r.whileloading.apply(c)},this._whileplaying=function(t,e,n,i,r){var s=c._iO;return isNaN(t)||null===t?!1:(c.position=Math.max(0,t),c._processOnPosition(),!c.isHTML5&&d>8&&(s.usePeakData&&"undefined"!=typeof e&&e&&(c.peakData={left:e.leftPeak,right:e.rightPeak}),s.useWaveformData&&"undefined"!=typeof n&&n&&(c.waveformData={left:n.split(","),right:i.split(",")}),s.useEQData&&"undefined"!=typeof r&&r&&r.leftEQ&&(t=r.leftEQ.split(","),c.eqData=t,c.eqData.left=t,"undefined"!=typeof r.rightEQ&&r.rightEQ)&&(c.eqData.right=r.rightEQ.split(","))),1===c.playState&&(!c.isHTML5&&8===d&&!c.position&&c.isBuffering&&c._onbufferchange(0),s.whileplaying&&s.whileplaying.apply(c)),!0)},this._oncaptiondata=function(t){c.captiondata=t,c._iO.oncaptiondata&&c._iO.oncaptiondata.apply(c)},this._onmetadata=function(t,e){var n,i,r={};for(n=0,i=t.length;i>n;n++)r[t[n]]=e[n];c.metadata=r,c._iO.onmetadata&&c._iO.onmetadata.apply(c)},this._onid3=function(t,e){var n,i,r=[];for(n=0,i=t.length;i>n;n++)r[t[n]]=e[n];c.id3=g(c.id3,r),c._iO.onid3&&c._iO.onid3.apply(c)},this._onconnect=function(t){t=1===t,(c.connected=t)&&(c.failures=0,j(c.id)&&(c.getAutoPlay()?c.play(void 0,c.getAutoPlay()):c._iO.autoLoad&&c.load()),c._iO.onconnect&&c._iO.onconnect.apply(c,[t]))},this._ondataerror=function(){0<c.playState&&c._iO.ondataerror&&c._iO.ondataerror.apply(c)}},T=function(){return ct.body||ct._docElement||ct.getElementsByTagName("div")[0]},u=function(t){return ct.getElementById(t)},g=function(t,e){var n,i,r=t||{};n="undefined"==typeof e?ot.defaultOptions:e;for(i in n)n.hasOwnProperty(i)&&"undefined"==typeof r[i]&&(r[i]="object"!=typeof n[i]||null===n[i]?n[i]:g(r[i],n[i]));return r},_={onready:1,ontimeout:1,defaultOptions:1,flash9Options:1,movieStarOptions:1},p=function(t,e){var n,i=!0,r="undefined"!=typeof e,s=ot.setupOptions;for(n in t)if(t.hasOwnProperty(n))if("object"!=typeof t[n]||null===t[n]||t[n]instanceof Array)r&&"undefined"!=typeof _[e]?ot[e][n]=t[n]:"undefined"!=typeof s[n]?(ot.setupOptions[n]=t[n],ot[n]=t[n]):"undefined"==typeof _[n]?(V(D("undefined"==typeof ot[n]?"setupUndef":"setupError",n),2),i=!1):ot[n]instanceof Function?ot[n].apply(ot,t[n]instanceof Array?t[n]:[t[n]]):ot[n]=t[n];else{if("undefined"!=typeof _[n])return p(t[n],n);V(D("undefined"==typeof ot[n]?"setupUndef":"setupError",n),2),i=!1}return i},tt=function(){function t(t){var t=Ct.call(t),e=t.length;return n?(t[1]="on"+t[1],e>3&&t.pop()):3===e&&t.push(!1),t}function e(t,e){var r=t.shift(),s=[i[e]];n?r[s](t[0],t[1]):r[s].apply(r,t)}var n=ht.attachEvent,i={add:n?"attachEvent":"addEventListener",remove:n?"detachEvent":"removeEventListener"};return{add:function(){e(t(arguments),"add")},remove:function(){e(t(arguments),"remove")}}}(),rt={abort:r(function(){}),canplay:r(function(){var t,e=this._t;if(e._html5_canplay)return!0;if(e._html5_canplay=!0,e._onbufferchange(0),t="undefined"==typeof e._iO.position||isNaN(e._iO.position)?null:e._iO.position/1e3,e.position&&this.currentTime!==t)try{this.currentTime=t}catch(n){}e._iO._oncanplay&&e._iO._oncanplay()}),canplaythrough:r(function(){var t=this._t;t.loaded||(t._onbufferchange(0),t._whileloading(t.bytesLoaded,t.bytesTotal,t._get_html5_duration()),t._onload(!0))}),ended:r(function(){this._t._onfinish()}),error:r(function(){this._t._onload(!1)}),loadeddata:r(function(){var t=this._t;t._loaded||Ot||(t.duration=t._get_html5_duration())}),loadedmetadata:r(function(){}),loadstart:r(function(){this._t._onbufferchange(1)}),play:r(function(){this._t._onbufferchange(0)}),playing:r(function(){this._t._onbufferchange(0)}),progress:r(function(t){var e,n,i=this._t,r=0,r=t.target.buffered;e=t.loaded||0;var s=t.total||1;if(i.buffered=[],r&&r.length){for(e=0,n=r.length;n>e;e++)i.buffered.push({start:r.start(e),end:r.end(e)});r=r.end(0)-r.start(0),e=r/t.target.duration}isNaN(e)||(i._onbufferchange(0),i._whileloading(e,s,i._get_html5_duration()),e&&s&&e===s&&rt.canplaythrough.call(this,t))}),ratechange:r(function(){}),suspend:r(function(t){var e=this._t;rt.progress.call(this,t),e._onsuspend()}),stalled:r(function(){}),timeupdate:r(function(){this._t._onTimer()}),waiting:r(function(){this._t._onbufferchange(1)})},$=function(t){return t.serverURL||t.type&&i(t.type)?!1:t.type?X({type:t.type}):X({url:t.url})||ot.html5Only},K=function(t,e){t&&(t.src=e)},X=function(t){if(!ot.useHTML5Audio||!ot.hasHTML5)return!1;var e,n=t.url||null,t=t.type||null,r=ot.audioFormats;if(t&&"undefined"!=typeof ot.html5[t])return ot.html5[t]&&!i(t);if(!Z){Z=[];for(e in r)r.hasOwnProperty(e)&&(Z.push(e),r[e].related&&(Z=Z.concat(r[e].related)));Z=RegExp("\\.("+Z.join("|")+")(\\?.*)?$","i")}return e=n?n.toLowerCase().match(Z):null,e&&e.length?e=e[1]:t&&(n=t.indexOf(";"),e=(-1!==n?t.substr(0,n):t).substr(6)),e&&"undefined"!=typeof ot.html5[e]?n=ot.html5[e]&&!i(e):(t="audio/"+e,n=ot.html5.canPlayType({type:t}),n=(ot.html5[e]=n)&&ot.html5[t]&&!i(t)),n},Q=function(){function t(t){var e,n,i=e=!1;if(!r||"function"!=typeof r.canPlayType)return e;if(t instanceof Array){for(e=0,n=t.length;n>e&&!i;e++)(ot.html5[t[e]]||r.canPlayType(t[e]).match(ot.html5Test))&&(i=!0,ot.html5[t[e]]=!0,ot.flash[t[e]]=!!t[e].match(Rt));e=i}else t=r&&"function"==typeof r.canPlayType?r.canPlayType(t):!1,e=!(!t||!t.match(ot.html5Test));return e}if(!ot.useHTML5Audio||"undefined"==typeof Audio)return!1;var e,n,i,r="undefined"!=typeof Audio?It?new Audio(null):new Audio:null,s={};i=ot.audioFormats;for(e in i)if(i.hasOwnProperty(e)&&(n="audio/"+e,s[e]=t(i[e].type),s[n]=s[e],e.match(Rt)?(ot.flash[e]=!0,ot.flash[n]=!0):(ot.flash[e]=!1,ot.flash[n]=!1),i[e]&&i[e].related))for(n=i[e].related.length-1;n>=0;n--)s["audio/"+i[e].related[n]]=s[e],ot.html5[i[e].related[n]]=s[e],ot.flash[i[e].related[n]]=s[e];return s.canPlayType=r?t:null,ot.html5=g(ot.html5,s),!0},D=function(){},F=function(t){return 8===d&&1<t.loops&&t.stream&&(t.stream=!1),t},H=function(t){return t&&!t.usePolicyFile&&(t.onid3||t.usePeakData||t.useWaveformData||t.useEQData)&&(t.usePolicyFile=!0),t},V=function(){},h=function(){return!1},B=function(t){for(var e in t)t.hasOwnProperty(e)&&"function"==typeof t[e]&&(t[e]=h)},z=function(t){"undefined"==typeof t&&(t=!1),(_t||t)&&ot.disable(t)},A=function(t){var e=null;if(t)if(t.match(/\.swf(\?.*)?$/i)){if(e=t.substr(t.toLowerCase().lastIndexOf(".swf?")+4))return t}else t.lastIndexOf("/")!==t.length-1&&(t+="/");return t=(t&&-1!==t.lastIndexOf("/")?t.substr(0,t.lastIndexOf("/")+1):"./")+ot.movieURL,ot.noSWFCache&&(t+="?ts="+(new Date).getTime()),t},P=function(){d=parseInt(ot.flashVersion,10),8!==d&&9!==d&&(ot.flashVersion=d=8);var t=ot.debugMode||ot.debugFlash?"_debug.swf":".swf";ot.useHTML5Audio&&!ot.html5Only&&ot.audioFormats.mp4.required&&9>d&&(ot.flashVersion=d=9),ot.version=ot.versionNumber+(ot.html5Only?" (HTML5-only mode)":9===d?" (AS3/Flash 9)":" (AS2/Flash 8)"),d>8?(ot.defaultOptions=g(ot.defaultOptions,ot.flash9Options),ot.features.buffering=!0,ot.defaultOptions=g(ot.defaultOptions,ot.movieStarOptions),ot.filePatterns.flash9=RegExp("\\.(mp3|"+Vt.join("|")+")(\\?.*)?$","i"),ot.features.movieStar=!0):ot.features.movieStar=!1,ot.filePattern=ot.filePatterns[8!==d?"flash9":"flash8"],ot.movieURL=(8===d?"soundmanager2.swf":"soundmanager2_flash9.swf").replace(".swf",t),ot.features.peakData=ot.features.waveformData=ot.features.eqData=d>8},I=function(t,e){return at?void at._setPolling(t,e):!1},L=function(){ot.debugURLParam.test(lt)&&(ot.debugMode=!0)},j=this.getSoundById,N=function(){var t=[];return ot.debugMode&&t.push("sm2_debug"),ot.debugFlash&&t.push("flash_debug"),ot.useHighPerformance&&t.push("high_performance"),t.join(" ")},R=function(){D("fbHandler");var t=ot.getMoviePercent(),e={type:"FLASHBLOCK"};return ot.html5Only?!1:void(ot.ok()?ot.oMC&&(ot.oMC.className=[N(),"movieContainer","swf_loaded"+(ot.didFlashBlock?" swf_unblocked":"")].join(" ")):(St&&(ot.oMC.className=N()+" movieContainer "+(null===t?"swf_timedout":"swf_error")),ot.didFlashBlock=!0,v({type:"ontimeout",ignoreInit:!0,error:e}),O(e)))},m=function(t,e,n){"undefined"==typeof dt[t]&&(dt[t]=[]),dt[t].push({method:e,scope:n||null,fired:!1})},v=function(t){if(t||(t={type:ot.ok()?"onready":"ontimeout"}),!pt&&t&&!t.ignoreInit||"ontimeout"===t.type&&(ot.ok()||_t&&!t.ignoreInit))return!1;var e,n={success:t&&t.ignoreInit?ot.ok():!_t},i=t&&t.type?dt[t.type]||[]:[],r=[],n=[n],s=St&&ot.useFlashBlock&&!ot.ok();for(t.error&&(n[0].error=t.error),t=0,e=i.length;e>t;t++)!0!==i[t].fired&&r.push(i[t]);if(r.length)for(t=0,e=r.length;e>t;t++)r[t].scope?r[t].method.apply(r[t].scope,n):r[t].method.apply(this,n),s||(r[t].fired=!0);return!0},y=function(){ht.setTimeout(function(){ot.useFlashBlock&&R(),v(),"function"==typeof ot.onload&&ot.onload.apply(ht),ot.waitForWindowLoad&&tt.add(ht,"load",y)},1)},nt=function(){if("undefined"!=typeof et)return et;var t,e=!1,n=navigator,i=n.plugins,r=ht.ActiveXObject;if(i&&i.length)(n=n.mimeTypes)&&n["application/x-shockwave-flash"]&&n["application/x-shockwave-flash"].enabledPlugin&&n["application/x-shockwave-flash"].enabledPlugin.description&&(e=!0);else if("undefined"!=typeof r){try{t=new r("ShockwaveFlash.ShockwaveFlash")}catch(s){}e=!!t}return et=e},Y=function(){var t,e,n=ot.audioFormats;if(Mt&&ut.match(/os (1|2|3_0|3_1)/i)?(ot.hasHTML5=!1,ot.html5Only=!0,ot.oMC&&(ot.oMC.style.display="none")):ot.useHTML5Audio&&(ot.hasHTML5=ot.html5&&ot.html5.canPlayType?!0:!1),ot.useHTML5Audio&&ot.hasHTML5)for(e in n)n.hasOwnProperty(e)&&(n[e].required&&!ot.html5.canPlayType(n[e].type)||ot.preferFlash&&(ot.flash[e]||ot.flash[n[e].type]))&&(t=!0);return ot.ignoreFlash&&(t=!1),ot.html5Only=ot.hasHTML5&&ot.useHTML5Audio&&!t,!ot.html5Only},G=function(t){var e,n,i=0;if(t instanceof Array){for(e=0,n=t.length;n>e;e++)if(t[e]instanceof Object){if(ot.canPlayMIME(t[e].type)){i=e;break}}else if(ot.canPlayURL(t[e])){i=e;break}t[i].url&&(t[i]=t[i].url),t=t[i]}return t},q=function(t){t._hasTimer||(t._hasTimer=!0,!Lt&&ot.html5PollingInterval&&(null===bt&&0===Pt&&(bt=ht.setInterval(U,ot.html5PollingInterval)),Pt++))},W=function(t){t._hasTimer&&(t._hasTimer=!1,!Lt&&ot.html5PollingInterval&&Pt--)},U=function(){var t;if(null!==bt&&!Pt)return ht.clearInterval(bt),bt=null,!1;for(t=ot.soundIDs.length-1;t>=0;t--)ot.sounds[ot.soundIDs[t]].isHTML5&&ot.sounds[ot.soundIDs[t]]._hasTimer&&ot.sounds[ot.soundIDs[t]]._onTimer()},O=function(t){t="undefined"!=typeof t?t:{},"function"==typeof ot.onerror&&ot.onerror.apply(ht,[{type:"undefined"!=typeof t.type?t.type:null}]),"undefined"!=typeof t.fatal&&t.fatal&&ot.disable()},it=function(){if(!Bt||!nt())return!1;var t,e,n=ot.audioFormats;for(e in n)if(n.hasOwnProperty(e)&&("mp3"===e||"mp4"===e)&&(ot.html5[e]=!1,n[e]&&n[e].related))for(t=n[e].related.length-1;t>=0;t--)ot.html5[n[e].related[t]]=!1},this._setSandboxType=function(){},this._externalInterfaceOK=function(){return ot.swfLoaded?!1:((new Date).getTime(),ot.swfLoaded=!0,At=!1,Bt&&it(),void setTimeout(c,Tt?100:1))},k=function(t,e){function n(t,e){return'<param name="'+t+'" value="'+e+'" />'}if(ft&&gt)return!1;if(ot.html5Only)return P(),ot.oMC=u(ot.movieID),c(),gt=ft=!0,!1;var i,r=e||ot.url,s=ot.altURL||r;i=T();var o,a,h,l=N(),d=null,d=(d=ct.getElementsByTagName("html")[0])&&d.dir&&d.dir.match(/rtl/i),t="undefined"==typeof t?ot.id:t;if(P(),ot.url=A(Nt?r:s),e=ot.url,ot.wmode=!ot.wmode&&ot.useHighPerformance?"transparent":ot.wmode,null!==ot.wmode&&(ut.match(/msie 8/i)||!Tt&&!ot.useHighPerformance)&&navigator.platform.match(/win32|win64/i)&&(ot.wmode=null),i={name:t,id:t,src:e,quality:"high",allowScriptAccess:ot.allowScriptAccess,bgcolor:ot.bgColor,pluginspage:Ft+"www.macromedia.com/go/getflashplayer",title:"JS/Flash audio component (SoundManager 2)",type:"application/x-shockwave-flash",wmode:ot.wmode,hasPriority:"true"},ot.debugFlash&&(i.FlashVars="debug=1"),ot.wmode||delete i.wmode,Tt)r=ct.createElement("div"),a=['<object id="'+t+'" data="'+e+'" type="'+i.type+'" title="'+i.title+'" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="'+Ft+'download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0">',n("movie",e),n("AllowScriptAccess",ot.allowScriptAccess),n("quality",i.quality),ot.wmode?n("wmode",ot.wmode):"",n("bgcolor",ot.bgColor),n("hasPriority","true"),ot.debugFlash?n("FlashVars",i.FlashVars):"","</object>"].join("");else for(o in r=ct.createElement("embed"),i)i.hasOwnProperty(o)&&r.setAttribute(o,i[o]);if(L(),l=N(),i=T())if(ot.oMC=u(ot.movieID)||ct.createElement("div"),ot.oMC.id)h=ot.oMC.className,ot.oMC.className=(h?h+" ":"movieContainer")+(l?" "+l:""),ot.oMC.appendChild(r),Tt&&(o=ot.oMC.appendChild(ct.createElement("div")),o.className="sm2-object-box",o.innerHTML=a),gt=!0;else{if(ot.oMC.id=ot.movieID,ot.oMC.className="movieContainer "+l,o=l=null,ot.useFlashBlock||(ot.useHighPerformance?l={position:"fixed",width:"8px",height:"8px",bottom:"0px",left:"0px",overflow:"hidden"}:(l={position:"absolute",width:"6px",height:"6px",top:"-9999px",left:"-9999px"},d&&(l.left=Math.abs(parseInt(l.left,10))+"px"))),kt&&(ot.oMC.style.zIndex=1e4),!ot.debugFlash)for(h in l)l.hasOwnProperty(h)&&(ot.oMC.style[h]=l[h]);   try{Tt||ot.oMC.appendChild(r),i.appendChild(ot.oMC),Tt&&(o=ot.oMC.appendChild(ct.createElement("div")),o.className="sm2-object-box",o.innerHTML=a),gt=!0}catch(f){throw Error(D("domError")+" \n"+f.toString())}}return ft=!0},S=function(){return ot.html5Only?(k(),!1):at?!1:(at=ot.getMovie(ot.id),at||(vt?(Tt?ot.oMC.innerHTML=yt:ot.oMC.appendChild(vt),vt=null,ft=!0):k(ot.id,ot.url),at=ot.getMovie(ot.id)),"function"==typeof ot.oninitmovie&&setTimeout(ot.oninitmovie,1),!0)},w=function(){setTimeout(x,1e3)},x=function(){var t,e=!1;return wt?!1:(wt=!0,tt.remove(ht,"load",w),At&&!zt?!1:(pt||(t=ot.getMoviePercent(),t>0&&100>t&&(e=!0)),void setTimeout(function(){return t=ot.getMoviePercent(),e?(wt=!1,ht.setTimeout(w,1),!1):void(!pt&&Dt&&(null===t?ot.useFlashBlock||0===ot.flashLoadTimeout?ot.useFlashBlock&&R():z(!0):0!==ot.flashLoadTimeout&&z(!0)))},ot.flashLoadTimeout)))},b=function(){return zt||!At?(tt.remove(ht,"focus",b),!0):(zt=Dt=!0,wt=!1,w(),tt.remove(ht,"focus",b),!0)},st=function(){var t,e=[];if(ot.useHTML5Audio&&ot.hasHTML5)for(t in ot.audioFormats)ot.audioFormats.hasOwnProperty(t)&&e.push(t+": "+ot.html5[t]+(!ot.html5[t]&&et&&ot.flash[t]?" (using flash)":ot.preferFlash&&ot.flash[t]&&et?" (preferring flash)":ot.html5[t]?"":" ("+(ot.audioFormats[t].required?"required, ":"")+"and no flash support)"))},f=function(t){if(pt)return!1;if(ot.html5Only)return pt=!0,y(),!0;var e,n=!0;return ot.useFlashBlock&&ot.flashLoadTimeout&&!ot.getMoviePercent()||(pt=!0,_t&&(e={type:!et&&St?"NO_FLASH":"INIT_TIMEOUT"})),(_t||t)&&(ot.useFlashBlock&&ot.oMC&&(ot.oMC.className=N()+" "+(null===ot.getMoviePercent()?"swf_timedout":"swf_error")),v({type:"ontimeout",error:e,ignoreInit:!0}),O(e),n=!1),_t||(ot.waitForWindowLoad&&!mt?tt.add(ht,"load",y):y()),n},l=function(){var t,e=ot.setupOptions;for(t in e)e.hasOwnProperty(t)&&("undefined"==typeof ot[t]?ot[t]=e[t]:ot[t]!==e[t]&&(ot.setupOptions[t]=ot[t]))},c=function(){if(pt)return!1;if(ot.html5Only)return pt||(tt.remove(ht,"load",ot.beginDelayedInit),ot.enabled=!0,f()),!0;S();try{at._externalInterfaceTest(!1),I(!0,ot.flashPollingInterval||(ot.useHighPerformance?10:50)),ot.debugMode||at._disableDebug(),ot.enabled=!0,ot.html5Only||tt.add(ht,"unload",h)}catch(t){return O({type:"JS_TO_FLASH_EXCEPTION",fatal:!0}),z(!0),f(),!1}return f(),tt.remove(ht,"load",ot.beginDelayedInit),!0},C=function(){return M?!1:(M=!0,l(),L(),!et&&ot.hasHTML5&&ot.setup({useHTML5Audio:!0,preferFlash:!1}),Q(),ot.html5.usingFlash=Y(),St=ot.html5.usingFlash,st(),!et&&St&&ot.setup({flashLoadTimeout:1}),ct.removeEventListener&&ct.removeEventListener("DOMContentLoaded",C,!1),S(),!0)},J=function(){return"complete"===ct.readyState&&(C(),ct.detachEvent("onreadystatechange",J)),!0},E=function(){mt=!0,tt.remove(ht,"load",E)},nt(),tt.add(ht,"focus",b),tt.add(ht,"load",w),tt.add(ht,"load",E),ct.addEventListener?ct.addEventListener("DOMContentLoaded",C,!1):ct.attachEvent?ct.attachEvent("onreadystatechange",J):O({type:"NO_DOM2_EVENTS",fatal:!0}),"complete"===ct.readyState&&setTimeout(C,100)}var n=null;"undefined"!=typeof SM2_DEFER&&SM2_DEFER||(n=new e),t.SoundManager=e,t.soundManager=n}(window);var Jiggler=function(t,e){Jiggler.__all.push(this),this.__bound=e||function(){},this.__pos=t||0,this.rest=t||0,this.vel=0,this.k=1,this.mass=3,this.d=.7};Object.defineProperty(Jiggler.prototype,"pos",{get:function(){return this.__pos},set:function(t){this.__pos=t,this.__bound(t)}}),Jiggler.prototype.bind=function(t){this.__bound=t},Jiggler.prototype.update=function(){var t=-(this.pos-this.rest)*this.k,e=t/this.mass;this.vel+=e,this.vel*=this.d,this.pos+=this.vel},Jiggler.__all=[],Jiggler.update=function(){for(var t=0,e=Jiggler.__all.length;e>t;t++)Jiggler.__all[t].update()},soundManager.setup({preferFlash:!0,flashVersion:9,useHighPerformance:!0,wmode:"transparent",debugMode:!1});var audio,numLoaded=0;soundManager.onready(function(){audio=soundManager.createSound({id:"peaking",url:"drums.mp3",multiShot:!0,autoLoad:!0,onload:function(){numLoaded++,audio.play(),audio.setVolume(0)},onfinish:function(){audio.play()}}),audio2=soundManager.createSound({id:"peaking2",url:"texture.mp3",multiShot:!0,autoLoad:!0,onload:function(){numLoaded++,audio2.play(),audio2.setVolume(0)},onfinish:function(){audio2.play()}})});var embedButton=document.getElementById("embed-button"),embedShade=document.getElementById("embed"),embedText=document.getElementById("embed-text");embedButton.addEventListener("click",function(t){return t.preventDefault(),embedShade.style.display="block",!1},!1),embedShade.addEventListener("click",function(){embedShade.style.display="none"},!1),embedText.addEventListener("click",function(t){return t.preventDefault(),t.stopPropagation(),this.select(),!1});var restDrag=.8,physics=new ParticleSystem(.34,-3,0,restDrag),params={mouseTargetEasing:.66,mouseTargetEasingUp:.66,needsDrag:!1,fillColor:"#000",strokeColor:"#000"},paths=[],particles=[],supports=[],supports2=[],springs=[],mouseDown=!1,firstPlay=!0,frameCount=0,numPoints=8,mouthPadding=2,idleTimeout,idleTimeoutLength=15e3,bend=-.015,smooth=!0,maxForce=30,segmentLength=getSegmentLength(),mouthPoints=numPoints-2*mouthPadding,thickness=110,strokeWeight=30,prevEyeRotation=0,hue=0,padding=(thickness+strokeWeight)/2,peaking=!1,prevPeaking=!1,lastPoint,stress=0,mousePos=new Point(view.size.width/2,view.size.height-segmentLength),targetMousePos=new Point(view.size.width/2,view.size.height-segmentLength),pathShadow=new Path,pathBody=new Path;pathBody.style={strokeColor:params.fillColor,strokeWidth:thickness+strokeWeight,strokeCap:"round"},paths.push(pathBody);var pathMouth=new Path;pathMouth.style={strokeColor:"#f03",strokeCap:"round"},pathMouth.opacity=0,paths.push(pathMouth);var pathTongue=new Path;pathTongue.style={strokeColor:"#AB2259",strokeCap:"round"},pathTongue.opacity=0,paths.push(pathTongue),buildMouth(),buildBody();var eyeHeight={s:1},blinkTween1=new TWEEN.Tween(eyeHeight).to({s:0},90).easing(TWEEN.Easing.Exponential.EaseIn),blinkTween2=new TWEEN.Tween(eyeHeight).to({s:1},140).easing(TWEEN.Easing.Exponential.EaseIn),blinkTween3=new TWEEN.Tween(eyeHeight).to({s:0},60).easing(TWEEN.Easing.Exponential.EaseIn),blinkTween4=new TWEEN.Tween(eyeHeight).to({s:1},180).easing(TWEEN.Easing.Exponential.EaseIn);blinkTween1.chain(blinkTween2),blinkTween2.chain(blinkTween3),blinkTween3.chain(blinkTween4),blinkTween4.chain(blinkTween1),blinkTween1.delay(9e3),blinkTween1.start(),navigator.userAgent.match(/(iPad|iPhone|iPod|Android)/i),wrong=setTimeout(function(){document.getElementById("shake").style.display="block"},15e3),document.getElementById("canvas").height++,document.getElementById("canvas").width++;var eyeJiggler=new Jiggler(6);eyeJiggler.k=4,eyeJiggler.mass=5;var firstRun=!0;setInterval(function(){physics.gravity.x=.4*Math.sin(Date.now()/4e3),physics.gravity.y=.4*Math.sin(Date.now()/6e3)-3,updateAppearance(),setPositions(),physics.tick(1)},1e3/60);var eye1Pos=new Point,eye2Pos=new Point;window.addEventListener("mouseout",function(){},!1);var _draw=view.draw;view.draw=function(){_draw.call(this),firstRun||onDraw(this._context)};</script><script type="text/paperscript" canvas="canvas">   function onFrame(e){Jiggler.update(),frameCount++,TWEEN.update(),updatePaths(),firstRun=!1}function onDraw(e){var t=pathBody.segments[numPoints-2],n=t.angle+Math.PI/2,s=(10*(Math.random()-Math.random()),Math.max(0,eyeJiggler.pos));eye1Pos.x=t.point.x,eye1Pos.y=t.point.y,eye1Pos.x+=Math.cos(n)*thickness/2.4,eye1Pos.y+=Math.sin(n)*thickness/2.4,eye2Pos.x=t.point.x,eye2Pos.y=t.point.y,eye2Pos.x-=Math.cos(n)*thickness/12,eye2Pos.y-=Math.sin(n)*thickness/12,e.fillStyle="#fff",e.save(),e.translate(eye1Pos.x,eye1Pos.y),e.rotate(n),e.scale(1,peaking?1:eyeHeight.s),circle(e,s),e.restore(),e.save(),e.translate(eye2Pos.x,eye2Pos.y),e.rotate(n),e.scale(peaking?1.2:1,peaking?1.2:eyeHeight.s),circle(e,s),e.restore(),e.shadowBlur=0,e.shadowOffsetY=0}function onMouseDown(e){mouseDown=!0}function onMouseUp(e){mouseDown=!1,params.needsDrag&&(targetMousePos.x=view.size.width/2,targetMousePos.y=view.size.height-segmentLength)}function onMouseMove(e){if(!params.needsDrag||mouseDown){var t=Math.atan2(e.point.y-view.size.height,e.point.x-view.size.width/2);targetMousePos.x=view.size.width/2+Math.cos(t)*segmentLength*3,targetMousePos.y=view.size.height+Math.sin(t)*segmentLength}}function onResize(){document.getElementById("canvas").height++,document.getElementById("canvas").width++,segmentLength=getSegmentLength(),particles[0].position.x=view.size.width/2,particles[0].position.y=view.size.height+segmentLength,targetMousePos.x=view.size.width/2,targetMousePos.y=view.size.height-segmentLength;for(var e=0;e<springs.length;e++)springs[e].length=segmentLength}function getSegmentLength(){return view.size.height/numPoints*.7}function buildMouth(){for(var e=0;mouthPoints>e;e++)pathMouth.add(new Point),mouthPoints-2>e&&pathTongue.add(new Point)}function buildBody(){for(i=0;i<numPoints;i++){var e=view.size.width/2,t=view.size.height-(i-1)*segmentLength,n=physics.makeParticle(2.5,e,t,0),s=physics.makeParticle(1,e,t-segmentLength,0),o=physics.makeParticle(1,e,t+segmentLength,0);if(i>0){var a=supports[i-1],h=particles[i-1];physics.makeSpring(n,a,.6,.48,0),physics.makeSpring(h,o,.3,.7,0),springs.push(physics.makeSpring(n,h,.2,.1,segmentLength))}i<2&&n.makeFixed(),s.makeFixed(),o.makeFixed();var r=new Point;pathBody.add(r),particles.push(n),supports.push(s),supports2.push(o)}}function setPositions(){var e=mouseDown?params.mouseTargetEasing:params.mouseTargetEasingUp;mousePos.x+=(targetMousePos.x-mousePos.x)*e,mousePos.y+=(targetMousePos.y-mousePos.y)*e,particles[1].position.x=mousePos.x,particles[1].position.y=mousePos.y;for(var t=0,n=1;numPoints>n;n++){var s=supports[n],o=particles[n];o.position.x=clamp(o.position.x,padding,view.size.width-padding);var a=particles[n-1],i=Math.atan2(o.position.y-a.position.y,o.position.x-a.position.x),h=o.force.length();h>maxForce&&(o.force.scale(h/maxForce),h=maxForce),n>1&&(t+=h),s.position.x=o.position.x+Math.cos(i+n*bend)*segmentLength,s.position.y=o.position.y+Math.sin(i+n*bend)*segmentLength,pathBody.segments[n].angle=i;var r=supports2[n];r.position.x=o.position.x+Math.cos(Math.PI+i)*segmentLength,r.position.y=o.position.y+Math.sin(Math.PI+i)*segmentLength}stress+=.03*(t-stress)}function updateAppearance(){stress>80?(hue+=stress>300?Math.pow(stress/5,2):stress,pathBody.strokeColor="hsl("+Math.round(hue)%360+", 100%, 50%)",pathMouth.strokeColor="hsl("+Math.round(hue)%360+", 100%, 90%)",pathTongue.strokeColor="hsl("+Math.round(hue)%360+", 100%, 50%)",pathMouth.strokeWidth=thickness/1.5+20*(Math.random()-Math.random()),pathTongue.strokeWidth=.65*pathMouth.strokeWidth,peaking=!0,clearTimeout(wrong),document.getElementById("shake").style.display="none"):(pathBody.strokeColor=params.fillColor,peaking=!1),peaking?(document.body.className=frameCount%3!=0?"bg-a":"bg-b",prevPeaking||(physics.drag=.2,pathMouth.opacity=1,pathTongue.opacity=1,eyeJiggler.rest=17),firstPlay&&audio&&(audio.setVolume(50),audio2.setVolume(70),firstPlay=!1)):!peaking&&prevPeaking&&(document.body.className="",physics.drag=restDrag,pathMouth.opacity=0,pathTongue.opacity=0,eyeJiggler.rest=6,audio&&(audio.setVolume(0),audio2.setVolume(0),firstPlay=!0)),prevPeaking=peaking}function updatePaths(){for(var e,t,n=0;numPoints>n;n++){var s=particles[n],o=(particles[n-1],pathBody.segments[n].angle+Math.PI/2);pathBody.segments[n].point.x=s.position.x,pathBody.segments[n].point.y=s.position.y,e=n-mouthPadding+1,t=pathMouth.segments.length,e>=0&&t>e&&(pathMouth.segments[e].point.x=s.position.x,pathMouth.segments[e].point.y=s.position.y,pathMouth.segments[e].point.x+=Math.cos(o)*thickness/6,pathMouth.segments[e].point.y+=Math.sin(o)*thickness/10,pathTongue.segments[e]&&(pathTongue.segments[e].point.x=pathMouth.segments[e].point.x,pathTongue.segments[e].point.y=pathMouth.segments[e].point.y,pathTongue.segments[e].point.x-=Math.cos(o)*(pathMouth.strokeWidth/15),pathTongue.segments[e].point.y-=Math.sin(o)*(pathMouth.strokeWidth/5)))}if(smooth)for(var n=0,t=paths.length;t>n;n++)paths[n].smooth()}function buildGUI(){var e=new dat.GUI;e.add(params,"mouseXWidth",0,1),e.add(params,"mouseYMin",0,1),e.add(params,"mouseTargetEasing",0,1),e.add(params,"needsDrag"),e.addColor(params,"fillColor"),e.addColor(params,"strokeColor")}function unSmooth(){for(var e=0,t=paths.length;t>e;e++)for(var n=paths[e],s=0,o=n.segments.length;o>s;s++){var a=n.segments[s];a.handleIn=a.handleOut=null}}function clamp(e,t,n){return t>e?t:e>n?n:e}function circle(e,t,n,s){e.beginPath(),e.arc(0,0,t,n||0,s||2*Math.PI,!0),e.fill()}soundManager.setup({preferFlash:!0,flashVersion:9,useHighPerformance:!0,wmode:"transparent",debugMode:!1});var audio,numLoaded=0;soundManager.onready(function(){audio=soundManager.createSound({id:"peaking",url:"drums.mp3",multiShot:!0,autoLoad:!0,onload:function(){numLoaded++,audio.play(),audio.setVolume(0)},onfinish:function(){audio.play()}}),audio2=soundManager.createSound({id:"peaking2",url:"texture.mp3",multiShot:!0,autoLoad:!0,onload:function(){numLoaded++,audio2.play(),audio2.setVolume(0)},onfinish:function(){audio2.play()}})});var embedButton=document.getElementById("embed-button"),embedShade=document.getElementById("embed"),embedText=document.getElementById("embed-text");embedButton.addEventListener("click",function(e){return e.preventDefault(),embedShade.style.display="block",!1},!1),embedShade.addEventListener("click",function(){embedShade.style.display="none"},!1),embedText.addEventListener("click",function(e){return e.preventDefault(),e.stopPropagation(),this.select(),!1});var restDrag=.8,physics=new ParticleSystem(.34,-3,0,restDrag),params={mouseTargetEasing:.66,mouseTargetEasingUp:.66,needsDrag:!1,fillColor:"#000",strokeColor:"#000"},paths=[],particles=[],supports=[],supports2=[],springs=[],mouseDown=!1,firstPlay=!0,frameCount=0,numPoints=8,mouthPadding=2,idleTimeout,idleTimeoutLength=15e3,bend=-.015,smooth=!0,maxForce=30,segmentLength=getSegmentLength(),mouthPoints=numPoints-2*mouthPadding,thickness=110,strokeWeight=30,prevEyeRotation=0,hue=0,padding=(thickness+strokeWeight)/2,peaking=!1,prevPeaking=!1,lastPoint,stress=0,mousePos=new Point(view.size.width/2,view.size.height-segmentLength),targetMousePos=new Point(view.size.width/2,view.size.height-segmentLength),pathShadow=new Path,pathBody=new Path;pathBody.style={strokeColor:params.fillColor,strokeWidth:thickness+strokeWeight,strokeCap:"round"},paths.push(pathBody);var pathMouth=new Path;pathMouth.style={strokeColor:"#f03",strokeCap:"round"},pathMouth.opacity=0,paths.push(pathMouth);var pathTongue=new Path;pathTongue.style={strokeColor:"#AB2259",strokeCap:"round"},pathTongue.opacity=0,paths.push(pathTongue),buildMouth(),buildBody();var eyeHeight={s:1},blinkTween1=new TWEEN.Tween(eyeHeight).to({s:0},90).easing(TWEEN.Easing.Exponential.EaseIn),blinkTween2=new TWEEN.Tween(eyeHeight).to({s:1},140).easing(TWEEN.Easing.Exponential.EaseIn),blinkTween3=new TWEEN.Tween(eyeHeight).to({s:0},60).easing(TWEEN.Easing.Exponential.EaseIn),blinkTween4=new TWEEN.Tween(eyeHeight).to({s:1},180).easing(TWEEN.Easing.Exponential.EaseIn);blinkTween1.chain(blinkTween2),blinkTween2.chain(blinkTween3),blinkTween3.chain(blinkTween4),blinkTween4.chain(blinkTween1),blinkTween1.delay(9e3),blinkTween1.start(),navigator.userAgent.match(/(iPad|iPhone|iPod|Android)/i),wrong=setTimeout(function(){document.getElementById("shake").style.display="block"},15e3),document.getElementById("canvas").height++,document.getElementById("canvas").width++;var eyeJiggler=new Jiggler(6);eyeJiggler.k=4,eyeJiggler.mass=5;var firstRun=!0;setInterval(function(){physics.gravity.x=.4*Math.sin(Date.now()/4e3),physics.gravity.y=.4*Math.sin(Date.now()/6e3)-3,updateAppearance(),setPositions(),physics.tick(1)},1e3/60);var eye1Pos=new Point,eye2Pos=new Point;window.addEventListener("mouseout",function(){},!1);var _draw=view.draw;view.draw=function(){_draw.call(this),firstRun||onDraw(this._context)};</script><style media="screen">body.bg-a{background:url()}body.bg-b{background:#fff}body,html{height:100%}body{margin:0;padding:0;overflow:hidden;background-color:#ffe5ed;background-image:-o-linear-gradient(bottom,#ffe5ed 0,#e0ffe9 100%);background-image:-moz-linear-gradient(bottom,#ffe5ed 0,#e0ffe9 100%);background-image:-webkit-linear-gradient(bottom,#ffe5ed,#e0ffe9);background-image:-ms-linear-gradient(bottom,#ffe5ed 0,#e0ffe9 100%);background-image:linear-gradient(bottom,#ffe5ed,#e0ffe9)}#compat{display:none;position:absolute;top:0;left:0;font:700 italic 150px serif;text-shadow:0 3px 0 rgba(0,0,0,.15);padding:20px 40px;color:#fff;z-index:2;pointer-events:none}@-webkit-keyframes shake{0%{left:30px}50%{left:0}to{left:30px}}@-moz-keyframes shake{0%{left:30px}50%{left:0}to{left:30px}}@keyframes shake{0%{left:30px}50%{left:0}to{left:30px}}#shake{word-break:break-word;bottom:0;right:0;display:none;top:0;left:0;font:700 italic 110px serif;text-shadow:0 3px 0 rgba(0,0,0,.15);padding:20px 40px;color:#fff;z-index:2;pointer-events:none;-webkit-animation-direction:normal;-webkit-animation-duration:.2s;-webkit-animation-iteration-count:infinite;-webkit-animation-name:shake;-webkit-animation-timing-function:ease;-moz-animation-direction:normal;-moz-animation-duration:.2s;-moz-animation-iteration-count:infinite;-moz-animation-name:shake;-moz-animation-timing-function:ease;animation-direction:normal;animation-duration:.2s;animation-iteration-count:infinite;animation-name:shake;animation-timing-function:ease}#shake,#warning{position:absolute}#warning{font:700 11px/14px sans-serif;width:240px;border:5px solid #000;text-align:center;padding:6px 6px 8px;background-color:#fff;left:10px;bottom:10px;z-index:3}#warning .english{margin-top:2px}#warning .chinese,#warning .english{display:inline-block;vertical-align:middle}#warning .chinese{font-size:14px}#enquiries{position:absolute;top:15px;right:20px;z-index:3}#enquiries a{display:inline-block;padding:5px 7px;text-decoration:none;border-radius:2px;font:700 12px sans-serif;color:#000;text-transform:uppercase}#enquiries a:hover{background-color:#fff}#embed{position:absolute;top:0;left:0;right:0;bottom:0;background:rgba(0,0,0,.6);z-index:4;display:none}#embed textarea{position:absolute;top:50%;left:50%;width:270px;height:100px;word-break:break-word;margin-left:-158px;margin-top:-50px;font:13px Monaco,monospace;padding:20px}</style><title>Staggering Beauty</title><meta name="title" content="Staggering Beauty" /><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><meta name="Description" content="A website to remember." /><meta name="viewport" content="initial-scale=0.6,user-scalable=no" /></head><body><canvas id="canvas" resize></canvas><div id="compat"></div><div id="shake">    Shake vigorously</div><div id="warning"><span class="english">WARNING: CONTAINS FLASHING IMAGES</span><br/><span class="chinese">&#21253;&#21547;&#38378;&#28865;&#30340;&#22270;&#20687;</span></div><div id="enquiries"><a target="_top" href=""></a><a id="embed-button" href=""></a></div><div id="embed"><textarea id="embed-text"></textarea></div><script type="text/javascript">var embedButton = document.getElementById('embed-button');var embedShade = document.getElementById('embed');var embedText = document.getElementById('embed-text');embedButton.addEventListener('click', function(e) {  e.preventDefault();  embedShade.style.display = 'block';  return false;}, false);embedShade.addEventListener('click', function() {  embedShade.style.display = 'none';}, false);embedText.addEventListener('click', function(e) {  e.preventDefault();  e.stopPropagation();  this.select();  return false;})</script></body></html>